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

.NET Framework HttpClient metrics #1

Closed
wants to merge 41 commits into from

Conversation

matt-hensley
Copy link
Owner

@matt-hensley matt-hensley commented Sep 18, 2023

Adds HttpClient metrics for .NET Framework 4.6.2 and newer. This implementation does not rely on tracing at all, and can be used without traces being sampled/recorded.

TODO

  • Metrics only tests
  • No metrics / no traces tests
  • Metrics + traces matching tests
  • Metrics generation when there is an exception
  • Duration from stopwatch when the activity is null


if (httpStatusCode.HasValue)
{
HttpClientDuration.Record(

Choose a reason for hiding this comment

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

Worth asking upstream (on the channel or in the SIG meeting), but I think that metric generation for .NET and .NET framework should be consistent. Which means, we should support flags for emitting old or new attributes: https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs#L67C20-L67C20

Copy link
Owner Author

Choose a reason for hiding this comment

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

Can ask in the SIG. For the OWIN metrics PR, they requested I use new attribute names. They did not ask to support both, so tbd.

Choose a reason for hiding this comment

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

Yes, OWIN didn't send any metrics at all, so going just with the new ones there seems fine to me.

However, for HttpClient, there are already metrics emitted for .NET. I think it would be awkward if HttpClient would emit different metrics for .NET and .NET framework.

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

Successfully merging this pull request may close these issues.

6 participants