Open vishweshbankwar opened 8 months ago
Adding comment from discussion on https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1426:
The main use case in my mind is filtering out unused metrics (noise). Some of our supported services don't need to collect metrics for every route in the application (and they currently don't in their non-OTel monitoring solutions). This filtering could also be done at the alerting/monitoring stage (metrics we don't care about could be identified by the dimensions collected/enriched by this instrumentation and filtered out of any dashboards/alerts), but why not avoid collecting unused metrics altogether?
Metric-level filters seem like the best way to reduce possible noise and collect metrics only for the routes/requests service owners are most interested in. Is there another OTel construct or tool aside from the Instrumentation packages that would fill the same role in its absence? Is there any downside to having filter options available?
Our team is starting to move towards OTel across our .NET services. If there is a better approach we'd be interested in trying it out as well. Thanks!
Please bring filtering back. As it was mentioned above, one use case is to reduce noise caused by healthchecks
I really don't understand the reason behind removing already implemented features. Performance or allocation? Even if so, that's a tradeoff which should be considered by the consumer. IMHO, Enrich and Filter should be de facto for all instrumentations.
We operate many microservices, each with multiple instances, within the Kubernetes environment. As you may know, it's best practice to use liveness and readiness probes for health check in K8s. However, it's worth noting that they contribute to increased metric noise.
// Should be filtered
/health/live
/health/ready
/metrics
We filter out a lot of health checks, version checks and a couple of internal controllers that are already kept track of in another way. Or for requests that result is very high cardinality. This reduces the total amount of noise in our metrics systems. And the additional load is negligible for us at least, our requests are quite heavy.
We also exclude k8s health checks or favicon.ico, robots.txt etc, it's very useful feature.
Adding my vote here for filtering out routes for health checks.
Basically, lack of this feature drives up cost of operations for the system, and the consumer should be able to choose which costs are bearable and which are not.
Also hoping to see the feature, while think it may be better to support from the .NET API so that the metrics we do not care would not be produced
also link to an issue in dotnet/aspnetcore https://github.com/dotnet/aspnetcore/issues/50654
We are looking forward to this coming back. There's a lot of extra in our exposed metrics right now (/metrics
, /healthz/*
)
Any update on this issue?
by adding OpenTelemetry.Instrumentation.AspNetCore and
builder.Services.AddOpenTelemetry()
.WithMetrics(builder =>
{
builder
.AddPrometheusExporter()
.AddMeter("Microsoft.AspNetCore.Hosting", "Microsoft.AspNetCore.Server.Kestrel");
})
.WithTracing(builder =>
{
builder
.AddAspNetCoreInstrumentation((options) => options.Filter = httpContext =>
{
if (httpContext.Request.Path.Value == "/metrics")
{
return false;
}
return true;
});
});
i think this will resolve my problem. not tested yet but seems bright enough
Thanks everyone for the feedback - The feature is requested for .NET9.0. Please track https://github.com/dotnet/aspnetcore/issues/50654 for updates.
It appears we need to wait for this fundamental feature until the .NET 9 release. Most of our customers only upgrade to LTS versions, which means we likely have to wait until .NET 10 or 11. Splendid!
Some pre-release versions of Metrics instrumentation provided support for filtering out measurements for
http.server.request.duration
. This option is removed in https://github.com/open-telemetry/opentelemetry-dotnet/pull/4981 and is not available in any of the supported .NET versions.Please share your feedback here in case you are affected by this change. Explain your scenario in detail as to why this feature is needed.