Repository navigation
Conversation
Fixes dotnet#6766 HistogramAttribute and HistogramAttribute<T> get an experimental HistogramBucketBoundaries property. The metrics source generator passes the values to Meter.CreateHistogram as InstrumentAdvice<T>, so collectors such as the OpenTelemetry SDK use them as the histogram's default explicit bucket boundaries. The property is only available when targeting .NET 10 or later, where InstrumentAdvice<T> always exists. The generator reports METGEN020 when the boundaries aren't distinct and increasing, or contain NaN, rather than letting InstrumentAdvice<T> throw when the instrument is created.
Collaborator
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1680013&view=codecoverage-tab |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6766
This adds a
HistogramBucketBoundariesproperty toHistogramAttribute<T>andHistogramAttribute, and the metrics source generator now passes it toMeter.CreateHistogramasInstrumentAdvice<T>. Right now the only way to get sensible buckets for a source-generated histogram is a View in every app that collects it. With this, the library that defines the histogram can ship the advice itself.generates
A few things worth calling out:
[Experimental](EXTEXP0003), likeDescription.Testing: the generator unit tests, the generated-code tests on net10.0 and net11.0, and the attribute tests pass locally on Linux. net8.0 and net9.0 only build here, and the net472 tests need Windows, so CI will be the first to run those.