-
Notifications
You must be signed in to change notification settings - Fork 283
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
[question] about configuring histogram buckets #2246
Comments
Hi @let-skip-cake,
|
@TimothyMothra Apologies, but the documentation seems outdated. By default, the histogram assigns values as le="2^n", where n is the metric's position index. The 12 Views were added during testing to demonstrate the issue. |
It looks up-to-date to me. Happy to fix, if you can be specific on what is missing/outdated.
Please share a minimal reproducible example. You can start with https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/metrics/customizing-the-sdk/Program.cs#L32 which shows how to provide custom buckets. |
Hello @cijothomas |
@let-skip-cake It doesn't look like you are using Prometheus Exporter from OpenTelemetry. "prometheus-net" and "prometheus-net-aspnetcore" are not related to OpenTelemetry.
Please make sure you use OpenTelemetry Prometheus Exporter and then also follow my earlier suggestion:
|
@cijothomas As you may notice, I'm working with an ASP.NET application, and my issue is that the bucket configuration isn’t applied in the view. If I create a console application following your example, the output to the console is correct. However, this isn't relevant to what I need. I've already reviewed and adapted this code for ASP.NET, but the bucket configuration still doesn’t apply, and I can’t figure out why. I'm using an ASP.NET project with dependency injection, and OpenTelemetry data is exported to Prometheus. The two libraries you mentioned are indeed used to create the telemetry data endpoint for Prometheus. internal static IApplicationBuilder UseOpenTelemetry(this IApplicationBuilder app)
{
app.UseHttpMetrics()
.UseMetricServer();
return app;
} Removing these libraries won’t affect the code above. services.AddOpenTelemetry()
.ConfigureResource(resource => resource
.AddService(serviceName: instanceName))
.WithTracing(tracing => tracing
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddOtlpExporter())
.WithMetrics(metrics => metrics
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation()
.AddView("*", bucketConfig)
.AddOtlpExporter()
);
return services; |
@let-skip-cake It is not clear from the description what is the issue you are facing. Also, the attached repro uses non-opentelemetry based prometheus packages, so we can't really offer any help with that. The following code snippet shared above does not even look like OpenTelemetry. (There is no UseMetricServer named method in OpenTelemetry).
To repeat, a minimal-reproducible-example will help us understand the issue being reported better and then we can help better. |
I think I understand now. It seems the bucket configurations are indeed generated by the Prometheus library. Could you please advise if it's possible to work with OpenTelemetry and Prometheus without using pre-release libraries? Or would it be better to directly use Prometheus metrics along with Prometheus libraries? This is all for ASP.NET 8, by the way. Thank you in advance |
See if this helps: https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics/getting-started-prometheus-grafana |
Component
class
MeterProviderBuilderExtensions
method
static MeterProviderBuilder AddView(this MeterProviderBuilder meterProviderBuilder, string instrumentName, MetricStreamConfiguration metricStreamConfiguration)
Package Version
Runtime Version
net8.0
Description
Hello, I am encountering an issue and would appreciate your help.
I have a Docker container set up with Prometheus and Grafana. Prometheus collects metrics from an application running on the host machine. I need to integrate a project using version 1.9.0 of the library (the latest stable version). The use of stable versions is strictly required for our project.
I am trying to configure metrics for our production project, but I am struggling to understand why the bucket separation does not seem to be working.
I wrote the following example based on these references:
Based on this and the tests in the library, I wrote the following example code. However, the metric configuration does not appear in Prometheus. Furthermore, bucket separation does not seem to work when checking /metrics.
Also, here is the class that defines the metric:
I've included the project archive in the description. Could you please help me identify what might be causing the issue?
Steps to Reproduce
https://localhost:7515/metrics
. Configured inProperties/launchSettings.json
test_computed
metric, and see resultExpected Result
See the histogram buckets into new segments
Actual Result
See the histogram buckets into default segments
Additional Context
PrometheusWebApi.zip
The text was updated successfully, but these errors were encountered: