-
Notifications
You must be signed in to change notification settings - Fork 806
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
Easier way to specify histogram boundaries? #3619
Comments
You might find this spec proposal interesting: |
Сan someone tell me how to at least somehow set buckets for histogram now? |
You need to define a View for it before the instruments are created |
new View({ |
thanks but in unit test we found other way to achieve it:
Opentelemetry is really great framework but looks like some cases are too complex here |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
Hmm, I think I had this suggestion working and now it's stopped. Is the metricName required? I thought I read that for instance just a units label would be enough. (eg, bytes versus ms) |
NB: Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenTelemetry client libraries. If so, please open an issue on opentelemetry-specification first.
Is your feature request related to a problem? Please describe.
It's currently somewhat unergonomic to create a histogram with custom buckets/boundaries. Because this must be done with
View
s, and becauseView
s can only be provided when aMeterProvider
is created, this means that the boundary configuration for a histogram must live in a completely separate part of the codebase from thecreateHistogram
call itself. In most cases I can imagine, the buckets for a given histogram are going to be tightly coupled to what individual histograms are measuring. For example, the boundaries for a histogram tracking SQL query duration are likely to be very different from the boundaries for a histogram tracking average response size, and in both cases I'd like to specify those boundaries when I'm creating the histogram metric.Describe the solution you'd like
I'd like to be able to define a histogram's boundaries when I call
createHistogram
.Per #2999, it looks like this used to be supported by the API, though I understand that this was removed in favor of using a
View
.If a
View
is the way to go, perhaps it would be possible to provide aView
in the call tocreateHistogram
? Maybe something like this:Alternatively, one could directly provide an aggregation and a
View
would be transparently create for the metric:Describe alternatives you've considered
AFAICT, there aren't any currently viable alternatives to creating a
View
alongside aMeterProvider
Additional context
This feature would make it possible to easily share and reuse histogram metrics via libraries. This would be really useful for e.g. building a library that can capture common Node metrics, including a histogram for GC duration with bucket sizes that have a sensible default. I'm thinking about something akin to this from the Prometheus world: https://github.com/siimon/prom-client/blob/8d6456c05f0708fed34628da5bd6f492a0ab43f8/lib/metrics/gc.js.
The text was updated successfully, but these errors were encountered: