-
Notifications
You must be signed in to change notification settings - Fork 862
[sdk-metrics] ExemplarReservoir dedicated diagnostic and custom ExemplarReservoir support #5558
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-metrics] ExemplarReservoir dedicated diagnostic and custom ExemplarReservoir support #5558
Conversation
To be more precise: I think we should refrain from exposing the ability to write custom Reservoirs in the initial release. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5558 +/- ##
==========================================
+ Coverage 83.38% 85.48% +2.10%
==========================================
Files 297 265 -32
Lines 12531 11337 -1194
==========================================
- Hits 10449 9692 -757
+ Misses 2082 1645 -437
Flags with carried forward coverage won't be shown. Click here to find out more.
|
| > metric View, although individual reservoirs MUST still be instantiated per | ||
| > metric-timeseries... | ||
| We are exposing these APIs experimentally until the specification declares them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: Spec is already stable, so we can remove that part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cijothomas I removed the stable part and added a lot more detail. Please re-review and LMK what you think.
| /// <typeparam name="T">Measurement type.</typeparam> | ||
| #if NET8_0_OR_GREATER | ||
| [Experimental(DiagnosticDefinitions.ExemplarExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)] | ||
| [Experimental(DiagnosticDefinitions.ExemplarReservoirExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not need this exposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec design is you give the AlignedHistogramBucketExemplarReservoir the buckets/configuration for the histogram and then when an exemplar is offered you calculate the index and always keep the latest update:
This internal int ExplicitBucketHistogramBucketIndex allows the SDK to pass it in so we don't have to do the calculation twice.
Should it be exposed?
It isn't part of the spec so I don't know if we can/should expose it. Chatting with @alanwest, it does seem like a useful thing to have available to custom reservoirs. The spec could have "MAY" language about exposing it. But it isn't a blocker for the current plan for the first stable release. In general, we (me, @alanwest, @cijothomas) have a lot of questions/concerns about the reservoir design which is why I think it is a good idea to keep it in preview initially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me 👍 . I asked because of this reason only - it does seem like a useful thing to have available to custom reservoirs. The AlignedHistogramBucketExemplarReservoir uses this so I thought someone writing the custom reservoir for histogram may also need this information.
vishweshbankwar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Relates to #2527
Changes
OTEL1004and movesExemplarReservoir,ExemplarMeasurement<T>, andMetricStreamConfiguration.ExemplarReservoirFactoryunder itFixedSizeExemplarReservoirunderOTEL1004so that users may author customExemplarReservoirsDetails
@alanwest, @cijothomas, and I have been working on a plan for exposing
Exemplars in 1.9.0. See: #2527This PR is performing the work as described in that plan. Primarily, we have decided that
ExemplarReservoirand customExemplarReservoirsupport will NOT be part of the first stable release. It has been given its own diagnostic so thatExemplar,SetExemplarFilter, andExemplarFilterTypecan be released on their own first.As far as the plan for supporting custom
ExemplarReservoirin prerelease builds...The spec says:
We have
public abstract class ExemplarReservoirbut that isn't the full story. There is currently no way set or update astruct Exemplarso actually implementing anExemplarReservoiris impossible.We could expose an update method or setters on
struct Exemplarbut that also isn't the full story.Exemplars have to be initialized with some magic in order for the tag filtering parts to work.The idea here is to expose
FixedSizeExemplarReservoirwhich takes care of all the heavy lifting and management ofExemplars allowing implementations to focus on their algorithms. Java seems to have similar but not totally sure if/how it is exposed.Chatting with @cijothomas we may want to just ignore this MUST from the spec. What I did is give
FixedSizeExemplarReservoirits own experimental API definition. The goal there is allow us to ship the other parts we are comfortable with independently of the support for custom reservoirs while still allowing users to try it out in prerelease builds.Example custom reservoir implementation
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes