Skip to content
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

[New article]: Source-generated metrics with strongly-typed tags #45165

Open
mobratil opened this issue Mar 7, 2025 · 0 comments
Open

[New article]: Source-generated metrics with strongly-typed tags #45165

mobratil opened this issue Mar 7, 2025 · 0 comments
Assignees
Labels
⌚ Not Triaged Not triaged

Comments

@mobratil
Copy link

mobratil commented Mar 7, 2025

Proposed topic or title

Source-generated metrics with strongly-typed tags

Location in table of contents.

core/diagnostics/metrics-instrumentation

Reason for the article

The .NET ecosystem provides source generation for logging, but an equivalent approach for metrics hasn't been documented yet. With the introduction of Microsoft.Extensions.Telemetry.Abstractions, developers can now generate strongly-typed metric tags and metric recording methods at compile-time.
This article will help developers understand the feature, reducing boilerplate and ensuring consistency in metric tagging. Without this documentation, users will struggle to adopt the feature efficiently.

Article abstract

This article explains how to use source generation to define strongly-typed metric tags in .NET. Using the Microsoft.Extensions.Telemetry.Abstractions package, developers can generate metric recording methods and tag definitions at compile-time, ensuring type safety and consistency across related metrics.
The article will guide readers through the setup, usage, and best practices for leveraging this feature effectively.

Relevant searches

  • .NET source-generated metrics
  • Microsoft.Extensions.Telemetry.Abstractions documentation
  • Strongly-typed metric tags in .NET
  • .NET compile-time metrics generation
  • Metrics instrumentation best practices in .NET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌚ Not Triaged Not triaged
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant