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

[sdk] Customize known connection histograms buckets #5008

Merged

Conversation

JamesNK
Copy link
Contributor

@JamesNK JamesNK commented Oct 31, 2023

Fixes #4922
Design discussion issue #4922

Changes

  • Updates known connection histograms to have larger buckets: 0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300. 10 seconds upper bound is good for HTTP requests but too short for useful information about most connections. 300 seconds (5 minutes) upper bound is better.
  • There is no standard for connection buckets in semantic conventions, so these are empirically derived.
  • Update the unit test to be more explicit about the expected result.

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)

@JamesNK JamesNK requested a review from a team October 31, 2023 00:25
@JamesNK
Copy link
Contributor Author

JamesNK commented Oct 31, 2023

FYI @samsp-msft @noahfalk

In .NET 9 and later, I expect this customization will happen against the instrument in the .NET source code, and OTEL will automatically pick it up.

Sam, I went with your initial numbers. While a connection could be longer than 5 minutes, it's a reasonable upper bound. They could be tweaked based on feedback.

@JamesNK JamesNK changed the title [sdk] Hardcode known connection histograms [sdk] Customize hardcoded known connection histograms buckets Oct 31, 2023
@JamesNK JamesNK changed the title [sdk] Customize hardcoded known connection histograms buckets [sdk] Customize known connection histograms buckets Oct 31, 2023
@JamesNK
Copy link
Contributor Author

JamesNK commented Oct 31, 2023

Is it possible for this change to make it into the 1.7.0 release?

@utpilla
Copy link
Contributor

utpilla commented Oct 31, 2023

Is it possible for this change to make it into the 1.7.0 release?

@JamesNK We could push for this change to be included in 1.7.0 release but could this requirement for a selective histogram bucket selection be documented?

Preferably in open-telemetry/semantic-conventions#283 or at least in the .NET docs: ASP .NET Core and System.Net Metrics. We could then comfortably refer to that to make a case for this change.

@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Merging #5008 (2d59aec) into main (c8f939e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5008   +/-   ##
=======================================
  Coverage   83.42%   83.42%           
=======================================
  Files         296      296           
  Lines       12377    12385    +8     
=======================================
+ Hits        10325    10332    +7     
- Misses       2052     2053    +1     
Flag Coverage Δ
unittests 83.42% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/OpenTelemetry/Metrics/AggregatorStore.cs 73.22% <100.00%> (+0.25%) ⬆️
src/OpenTelemetry/Metrics/Metric.cs 96.46% <100.00%> (+0.12%) ⬆️

... and 4 files with indirect coverage changes

@JamesNK
Copy link
Contributor Author

JamesNK commented Oct 31, 2023

Is it possible for this change to make it into the 1.7.0 release?

@JamesNK We could push for this change to be included in 1.7.0 release but could this requirement for a selective histogram bucket selection be documented?

Preferably in open-telemetry/semantic-conventions#283 or at least in the .NET docs: ASP .NET Core and System.Net Metrics. We could then comfortably refer to that to make a case for this change.

Done - open-telemetry/semantic-conventions#283 (review)

("System.Net.Http", "http.client.request.duration"),
("System.Net.Http", "http.client.request.time_in_queue"),
("System.Net.NameResolution", "dns.lookups.duration"),
};

// Long default histogram bounds. Not based on a standard. May change in the future.
internal static readonly double[] DefaultHistogramBoundsLongSeconds = new double[] { 0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300 };
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 Author

Choose a reason for hiding this comment

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

The other buckets bounds have a zero value. I think this PR should focus on one thing, and if removing zero makes sense then it can be a new PR.

Copy link
Member

Choose a reason for hiding this comment

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

FYI - we will fix the other buckets as well for 1.7.0 release
#4908

Choose a reason for hiding this comment

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

I don't mind if its one PR or two, but we should fix now while we can, and before it gets adopted - although I don't think its a breaking change.

Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
@utpilla utpilla merged commit 37481f1 into open-telemetry:main Nov 3, 2023
69 checks passed
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.

Histogram buckets for connection metrics should be longer than request buckets
4 participants