Skip to content

.NET 6 Metrics - How to configure buckets for histograms? #3245

Answered by tomkerkhove
hannahchan asked this question in Q&A
Discussion options

You must be logged in to vote

You can add a view and define the bucket size, for example:

 var configuredMetricProvider = Sdk.CreateMeterProviderBuilder()
                .AddMeter("Sample.*")
                .AddOtlpExporter(options => options.Endpoint = new Uri(collectorUri))
                .AddView("*", new ExplicitBucketHistogramConfiguration { Boundaries = histogramBuckets })
                .Build();

You cannot do this per bucket, unfortunately. See #2755

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by hannahchan
Comment options

You must be logged in to vote
4 replies
@hannahchan
Comment options

@cijothomas
Comment options

@hannahchan
Comment options

@cijothomas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants