-
Notifications
You must be signed in to change notification settings - Fork 159
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
How to set histogram metric bucket size after meter registration #660
Comments
Hi @JustasL,
and that can be set when building the View:
|
@bryce-b yes, but then I need to register multiple histogram instruments, right? Can I register new instruments, after I've called Because on Android my colleagues can specify histogram bucket right before collecting the data, and on iOS it's not possible to Here's how I ma currently doing it on iOS:
And then:
|
You'll need to register multiple views and specify an InstrumentSelector.
This tells the MeterProvider which view is responsible for which histogram meter. |
Meaning I can not modify histogram buckets at runtime, after StableMeterProvider was setup? |
It would appear that the functionality provided in Android is not within the OpenTelemetry spec, so there is no intention to align this project with it. It is possible to create additional StableMeterProviders outside of the registered one, if that might help your problem, but updating the bucketing on the fly seems an unusual use-case |
Could you share and example, or documentation? That would help greatly |
It's done the same way as if you were registering it with the singleton, you just have to manage the StableMeterProvider yourself. https://github.com/open-telemetry/opentelemetry-swift/blob/main/Examples/Stable%20Metric%20Sample/main.swift#L61C60-L64C13 |
Let's say one flow needs bucket size A, other will need size B, how can I support these different buckets at runtime? Sounds like I need manually keep track of created buckets sizes, and then if new bucket size is needed, I need to call This seems to be very basic histogram requirement, I am not fully sure why it's not implemented, and there is no plan to support specifying bucket size dynamically at runtime |
When you say flow are you meaning a user flow, an instrument, or something else? Are you saying that you don't know what you want your buckets to be before capturing data, so you want to restructure the bucketing while data is being aggregated? If you mean you have two instruments you can assign two separate views to each which will produce two separate Views with histogram aggregators.
where there are two instruments:
If you want to produce two different bucketing for the same instrument. you can do it like this:
Where the instrument is:
I was looking at bit closer at the API you shared from Java, and it appears to actually be part of Instrument Advisory API, which doesn't appear to affect a view's aggregation, from what I can tell. |
Hello, is there a way to set histogram bucket after the metes has been registered?
From looking at source code and examples it does not seem like it's possible on iOS
My Android colleague is using this method, like this:
Where as iOS histogram builder does not have such option
The text was updated successfully, but these errors were encountered: