-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Write an example showing how to create a histogram from a value recorder #1280
Comments
Is there an example available anywhere of how to do this? I can wait for the docs for a complete explanation, but for now just somewhere to start with a working example would be helpful. It seems like you create a histogram with |
I would be happy to write this example if someone could provide some hint about how to do this? I've been searching through the code trying to understand how histogram/aggregator/accumulation all relate and how to actually create a histogram, measure a value, and have it reflected as a set of |
For anyone else trying to solve the mystery of how to get a histogram it's actually very easy - it's just not documented anywhere (that I can find). I found it as a passing mention in another issue (#689). Now it's making more sense, it's just difficult to decipher due to differences in API choices made by the opentelemetry api and the prometheus api.
So you just create a value recorder and it will be automatically translated into a histogram with automatic bucket boundaries. examplehisto, err = meter.NewFloat64ValueRecorder(
"example",
metric.WithDescription(string(unit.Dimensionless)),
metric.WithDescription("Some values that will become a histogram in the prometheus exporter"),
) Now to add values you use global.Meter("name").RecordBatch(ctx, labels, examplehisto.Measurement(myvalue)) |
Looks like there's an example now, under |
Stale, closing. There is an example of how to manage histograms added in #3177 FWIW |
Write a complete representation of what it takes to create a histogram that aggregates values from a value recorder.
The sample should have code that:
The text was updated successfully, but these errors were encountered: