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

[ASP.NET Core] Remove suppression for metrics generated from prometheus #5044

5 changes: 5 additions & 0 deletions src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ exception. The attribute value will be set to full name of exception type.
* Fixed `network.protocol.version` attribute values to match the specification.
([#5007](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5007))

* Removed filtering of metrics when the request path contained `/metrics`. This
change may affect prometheus pull scenario if the prometheus server sends
Copy link
Member

@cijothomas cijothomas Nov 13, 2023

Choose a reason for hiding this comment

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

Probably nit picking, but the wording "may affect" may not be clear as to what is the effect? The effect of this PR is - metrics now include measurements from prometheus scrape requests. So one possible effect is - users see more count and their avge, etc might be affected. Eg: the service's latency is one-digit-ms only, but prometheus scrapes take seconds.. Now, by including prometheus scrapes to the latency metric, it may give false impression that the service slowed! It could be immaterial, if prom scrapes are a minute fraction (quite likely.)

Not a blocker for the PR!

Copy link
Member Author

Choose a reason for hiding this comment

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

I reworded first line a bit more. The point about latency is valid but I don't think it falls under the instrumentation library's scope (library simply reports metrics). I think it was a bug that we were filtering measurements and not giving the full picture.

request to the scrapping endpoint that contains `/metrics` in path.
([#5044](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5044))

## 1.6.0-beta.2

Released 2023-Oct-26
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,6 @@ public void OnEventWritten_New(string name, object payload)
return;
}

// TODO: Prometheus pulls metrics by invoking the /metrics endpoint. Decide if it makes sense to suppress this.
// Below is just a temporary way of achieving this suppression for metrics (we should consider suppressing traces too).
// If we want to suppress activity from Prometheus then we should use SuppressInstrumentationScope.
if (context.Request.Path.HasValue && context.Request.Path.Value.Contains("metrics"))
{
return;
}

TagList tags = default;

// see the spec https://github.com/open-telemetry/semantic-conventions/blob/v1.21.0/docs/http/http-spans.md
Expand Down
Loading