opentelemetry-dotnet
opentelemetry-dotnet copied to clipboard
Custom tags for AspNetCore metrics
Feature Request
Is there any way to add custom tags for /metrics in OpenTelemetry.Instrumentation.AspNetCore? I want to add environment and service name.
Describe the solution you'd like:
It would be great to have the ability to enrich default metrics with custom tags. For example, it can look like this:
.AddAspNetCoreInstrumentation(x => x.CustomStaticTags = new Dictionary<string, string>()
{
["environment"] = "stage",
["application"] = "orders"
})
Describe alternatives you've considered.
The only alternative I see is to copy-paste
MeterProviderBuilderExtensions.cs
AspNetCoreMetrics.cs
HttpInMetricsListener.cs
DiagnosticSourceSubscriber.cs
HttpTagHelper.cs
ListenerHandler.cs
to my project and add a way to customize tags myself.