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

HttpSemanticConventions - new metric in AspNetCore Instrumentation. #4802

Merged
merged 51 commits into from
Sep 14, 2023
Merged

HttpSemanticConventions - new metric in AspNetCore Instrumentation. #4802

merged 51 commits into from
Sep 14, 2023

Conversation

TimothyMothra
Copy link
Contributor

@TimothyMothra TimothyMothra commented Aug 24, 2023

Towards #4484
Supersedes #4766

This PR focus on introducing the new http.server.request.duration metrics in the AspNetCore Instrumentation library.

Changes

Future work

  • The unit of this metric needs to be changed to seconds. This requires a different default histogram. DONE!

Merge requirement checklist

  • CONTRIBUTING guidelines followed (nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@codecov
Copy link

codecov bot commented Aug 24, 2023

Codecov Report

Merging #4802 (0015a20) into main (680115f) will increase coverage by 0.00%.
The diff coverage is 68.18%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4802   +/-   ##
=======================================
  Coverage   83.90%   83.90%           
=======================================
  Files         293      293           
  Lines       12001    12028   +27     
=======================================
+ Hits        10069    10092   +23     
- Misses       1932     1936    +4     
Files Changed Coverage
...AspNetCore/Implementation/HttpInMetricsListener.cs 68.18%

@TimothyMothra TimothyMothra changed the title HttpSemanticConventions - new metric is AspNetCore Instrumentation HttpSemanticConventions - new metric in AspNetCore Instrumentation. Aug 24, 2023
@TimothyMothra TimothyMothra marked this pull request as ready for review August 24, 2023 22:45
@TimothyMothra TimothyMothra requested a review from a team August 24, 2023 22:45
| Name | Instrument Type | Unit | Description |
|-------|-----------------|------|-------------|
| `http.server.duration` | Histogram | `ms` | Measures the duration of inbound HTTP requests. |
Have you opt-ed into the new Http Semantic Conventions using `OTEL_SEMCONV_STABILITY_OPT_IN`?
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Have you opt-ed into the new Http Semantic Conventions using `OTEL_SEMCONV_STABILITY_OPT_IN`?
Have you opted in to the new Http Semantic Conventions using `OTEL_SEMCONV_STABILITY_OPT_IN`?

| `http.server.request.duration` | Histogram | `s` | Measures the duration of inbound HTTP requests. |

This metric is emitted in `seconds` as per the semantic convention. While
the convention [recommends using custom histogram buckets](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpserverrequestduration)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the commit tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm conflicted here.
I would rather link to an explicit tag. There changes we're implementing now are post v1.21.0, but this repo hasn't made a new release yet.

I can change links in both the Readme and Changelog to a commit as you've suggested.
When the next release happens (presumably v1.22.0) I think we should update these links.

into the new semantic convention by configuring the `OTEL_SEMCONV_STABILITY_OPT_IN`
environment variable. This metric measures time in seconds and offers unique
histogram buckets as per the
[spec](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpserverrequestduration)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@utpilla utpilla left a comment

Choose a reason for hiding this comment

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

Left a few suggestions for CHANGELOG and README.

* Introduced a new metric, `http.server.request.duration`, for users who opt
into the new semantic convention by configuring the `OTEL_SEMCONV_STABILITY_OPT_IN`
environment variable. This metric measures time in seconds and offers unique
histogram buckets as per the
Copy link
Member

Choose a reason for hiding this comment

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

This metric measures time in seconds and offers unique
histogram buckets

Not sure how to interpret "offers unique histogram buckets"? What does it mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"offers" is the wrong word here, "uses" would be more appropriate.
I'm trying to call attention to the fact that the buckets are different than the default.
4 lines below this I list the exact buckets.

I'm trying to find a succinct way to describe that this metric is different than what came before.
@cijothomas, do you think this would be better as a bulleted list?

ie:

- new metric: `http.server.request.duration`
- unit: seconds
- buckets: 0, 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1,
  2.5, 5, 7.5, 10

Copy link
Member

Choose a reason for hiding this comment

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

the list is good. Hint that the buckets are so, because SDK specially handles this metric.

| `http.server.duration` | Histogram | `ms` | Measures the duration of inbound HTTP requests. |
Have you opt-ed into the new Http Semantic Conventions using `OTEL_SEMCONV_STABILITY_OPT_IN`?

* If yes, the instrumentation supports the following metric.
Copy link
Member

Choose a reason for hiding this comment

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

this is not clear. The env variable can take none,http,http/dup as values, This doc should also be structured in that way. i.e what if the env variable is set to "none", (also the default)
what is the env varaible is set to "http"
what is the env varaible is set to "http/dup" - both metric are emitted

@TimothyMothra
Copy link
Contributor Author

@utpilla, @cijothomas, @vishweshbankwar
I've rewritten both the Readme and Changelog. Please re-review.

@@ -2,6 +2,26 @@

## Unreleased

* Introduced a new metric, `http.server.request.duration`, for users who opt-in
Copy link
Member

Choose a reason for hiding this comment

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

Introduced a new metric, http.server.request.duration, for users who opt-in
to the new semantic convention by configuring the OTEL_SEMCONV_STABILITY_OPT_IN
environment variable to value "fillthis". This metric measures time in seconds, but histogram buckets are adjusted
automatically for this metric by OTel SDK which specially treat this metric. This metric follows the OTel Semantic Conventions from (add link).

  • Metric Name: http.server.request.duration
  • Unit: seconds
  • Histogram Buckets: 0, 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 (due to OpenTelemetry SDK's special treatment)
  • Replaces old metric: http.server.duration
    • Unit: miliseconds
    • Histogram Buckets: 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000 (the general default of Histogram buckets)

OTEL_SEMCONV_STABILITY_OPT_IN may be set to "fillthis", to help an easier transition, at the cost of emitting both old and new metrics.

^did some refactoring. Feel free to take it with modifications.
A user who do not have any experience with OTel sem. conventions and the new vs old, should find it easy to follow the changelog. Key things I'd prefer to convey here are:

  1. No breaking changes if you just update to this new version.
  2. Opt-in feature to emit a new metric that follows a new convention, which despite using "s", still allows good histogram precision due to SDK treating it specially.
  3. Hint at emitting both to smooth transition.
  4. Hint that the new metric is the long term bet, as it'll be the one getting stabilizied by Otel sem convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the refactor. I'll take another pass at this today.

Do we typically put instructions in the changelog? I was trying to keep the changelog succinct, and use the readme for the full information. The challenge is that this change has a LOT of details :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just pushed my rewrite. I think I've addressed all your points. please re-review.

@utpilla
Copy link
Contributor

utpilla commented Sep 14, 2023

@TimothyMothra Thanks for your patience on working on this PR!

@utpilla utpilla merged commit 9139b72 into open-telemetry:main Sep 14, 2023
49 checks passed
@TimothyMothra TimothyMothra deleted the 4484_newMetrics branch September 14, 2023 23:14
@TimothyMothra
Copy link
Contributor Author

@TimothyMothra Thanks for your patience on working on this PR!

This one was tricky and touched a lot of parts! Glad we could get this merged.

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