Skip to content

add CommTagAttribute for metric code generator #6244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BowenYang666
Copy link
Contributor

@BowenYang666 BowenYang666 commented Apr 4, 2025

Support common tag and value for the same group of metrics

[CommonTag("Category", "Http")]
[CommonTag("MetricVersion", "v1")]
 static partial class Metric
 {
    [Counter("RequestName", "RequestStatusCode")]
    static partial RequestCounter CreateRequestCounter(Meter meter);
}
Microsoft Reviewers: Open in CodeFlow

@BowenYang666
Copy link
Contributor Author

@BowenYang666 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree company="Microsoft"

Bowen Yang (from Dev Box) added 2 commits April 4, 2025 15:02
@BowenYang666 BowenYang666 marked this pull request as ready for review April 7, 2025 01:30
@BowenYang666 BowenYang666 requested a review from a team as a code owner April 7, 2025 01:30
@dariusclay
Copy link
Member

This seems like a cool idea. Did you write up an API proposal for this? Since it's a new feature we might want to discuss it there, so that we don't end up having to change things later.

/// </example>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
[Conditional("CODE_GENERATION_ATTRIBUTES")]
[Experimental("EXPERIMENTAL_COMMON_TAG_ATTRIBUTE")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use the well-defined experiment IDs

Suggested change
[Experimental("EXPERIMENTAL_COMMON_TAG_ATTRIBUTE")]
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]

@BowenYang666
Copy link
Contributor Author

BowenYang666 commented Apr 8, 2025

This seems like a cool idea. Did you write up an API proposal for this? Since it's a new feature we might want to discuss it there, so that we don't end up having to change things later.

Thanks Darius. I have created a new feature proposal here:
#6259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants