-
Notifications
You must be signed in to change notification settings - Fork 894
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
Propose histogram bucket boundary metric advice (aka hint API) #3216
Conversation
I really like this idea. I am wondering if we want to enhance this so you can also define the aggregation of a metric? |
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.
Awesome small and targeted proposal! I think we (additionally) need the two features I mentioned as part of stabilizing HTTP semconv, but happy to have them as follow on features.
I've marked the PR as ready for review. I think there are additional advice arguments we can expose (I'm most excited about solving #3061), but that this is a great start and probably something we can all agree on. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
I've pushed a commit that adjusts the document status to be "Stable except where otherwise specified", and calls out the new advice portions as experimental. This has been open for ~6 weeks and the feedback has mostly positive with some requests for additional advice parameters that could be added in separate PRs. @open-telemetry/specs-metrics-approvers please review so we can reach a resolution. |
I like this change that could unblock our adoption of Otel. In all our existing use case (on OC), user will always provide buckets for any histogram. However as bucket is not a secondary citizen when defining a histogram. I'm wondering why we don't make it as explicit option parameters for histogram just like what Prometheus Java Client does. |
The OpenTelemetry SDK is highly configurable in terms of how measurements are aggregated and exported from an application. Whether the bucket boundaries were to be provided as a parameter for the histogram instrument or via this advice API, the SDK operator would always have the ability to override it. The value of |
@pirgeo, @reyang, @cijothomas, @arminru Tagging the others who have previously commented, please take another look. Would be good to get this in so we can start gathering feedback. |
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. A non-blocking thing for us to think about - do we want the "advice" to be a flexible thing such as a single JSON string? This would allow vendors to add their specific hints rather than requiring an API change. It also allows the API/SDK to move faster without having to bundle the release cycles (e.g. think about this, if we're going to add another "advice" regarding "recommended dimensions", with the strongly typed approach it'll probably take 6-12 months).
I think @jmacd might have suggested something similar in the past? |
LGTM too. About flexible advice - I am not sure I understand how and where this would be parsed so that it is flexible enough for all (or at least most) needs - @reyang could you elaborate on that a bit more? Seems like a big chunk of work to me, and might be outside the scope of this PR. |
I think its worth exploring (in a subsequent iteration 🙂). It would essentially allow us to have an API that remains stable, while incrementally adding to the SDK specification. The API might accept a JSON string, or some other generic structure like a map:
And its up to the SDK to interpret the advice and extract out any relevant bits. In this case, the SDK would look for "explicitBucketBoundaries" entry in the map, and interpret the value as the bucket boundaries. Later, if we add additional advice for default attribute keys, there's no need for the API to change:
The SDK just needs to add additional language to interpret the new "defaultAttributeKeys" entry in the map. |
…telemetry#3216) Fixes open-telemetry#2229. Related to open-telemetry#3061 (lays groundwork but does not resolve). Related to open-telemetry#2977, which may use this new API to have `http.server.duration` report in seconds instead of ms without changing / breaking default bucket boundaries. Summary of the change: - Proposes a new parameter to optionally include when creating instruments, called "advice". - For the moment, advice only has one parameter for specifying the bucket boundaries of explicit bucket histogram. - Advice can be expanded with additional parameters in the future (e.g. default attributes to retain). The parameters may be general (aka applicable to all instruments) or specific to a particular instrument kind, like bucket boundaries. - Advice parameters can influence the [default aggregation](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#default-aggregation), which is used if there is no matching view and if the reader does not specify a preferred aggregation. - Not clear that all advice will be oriented towards configuring aggregation, so I've intentionally left the scope of what they can influence open ended. I've prototyped this in java [here](open-telemetry/opentelemetry-java#5217). Example usage: ``` DoubleHistogram doubleHistogram = meterProvider .get("meter") .histogramBuilder("histogram") .setUnit("foo") .setDescription("bar") .setAdvice( advice -> advice.setBoundaries(Arrays.asList(10.0, 20.0, 30.0))) .build(); ``` Advice could easily be changed to "hint" with everything else being equal. I thought "advice" clearly described what we're trying to accomplish, which is advice / recommend the implementation in providing useful output with minimal configuration. --------- Co-authored-by: Reiley Yang <reyang@microsoft.com>
Fixes #2229.
Related to #3061 (lays groundwork but does not resolve).
Related to #2977, which may use this new API to have
http.server.duration
report in seconds instead of ms without changing / breaking default bucket boundaries.Summary of the change:
I've prototyped this in java here. Example usage:
Advice could easily be changed to "hint" with everything else being equal. I thought "advice" clearly described what we're trying to accomplish, which is advice / recommend the implementation in providing useful output with minimal configuration.