Skip to content
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

Metrics page may appear blank after a few seconds. #5713

Closed
mhdimsy opened this issue Jun 23, 2024 · 6 comments
Closed

Metrics page may appear blank after a few seconds. #5713

mhdimsy opened this issue Jun 23, 2024 · 6 comments
Labels
question Further information is requested

Comments

@mhdimsy
Copy link

mhdimsy commented Jun 23, 2024

What is the question?

Hello everyone.
The metrics page may appear blank after a few seconds.
Then Prometheus shows the job is up, but metrics are not scraped.

My config is

services.AddOpenTelemetry()
.ConfigureResource(resource => resource.AddService("backend"))
.WithMetrics(builder => builder
.AddMeter(FormStepHandlerMeter.name)
                    .AddMeter("Microsoft.AspNetCore.Hosting")
                    .AddMeter("Microsoft.AspNetCore.Http.Connections")
                    .AddMeter("Microsoft.AspNetCore.Routing")
                    .AddMeter("Microsoft.AspNetCore.Diagnostics")
                    .AddMeter("Microsoft.AspNetCore.RateLimiting")
                    .AddAspNetCoreInstrumentation()
                    .AddRuntimeInstrumentation()
                    .AddPrometheusExporter()
                )

I use dotnet 6 and this packages:
OpenTelemetry.Exporter.Console 1.9.0
OpenTelemetry.Exporter.Prometheus.AspNetCore 1.9.0-beta.1
OpenTelemetry.Extensions.Hosting 1.9.0
OpenTelemetry.Instrumentation.AspNetCore 1.9.0
OpenTelemetry.Instrumentation.EntityFrameworkCore 1.0.0-beta.12
OpenTelemetry.Instrumentation.Http 1.9.0
OpenTelemetry.Instrumentation.Runtime 1.9.0
OpenTelemetry.Instrumentation.SqlClient 1.9.0-beta.1

Even though nothing is being collected, it takes 259.968 to complete(last scraping).

@mhdimsy mhdimsy added the question Further information is requested label Jun 23, 2024
@mhdimsy mhdimsy changed the title When I refresh the metrics page a couple of times, it becomes blank and empty. Metrics page may appear blank after a few seconds. Jun 23, 2024
@cijothomas
Copy link
Member

Is the scraping endpoint setup as well? (The code snippet above does not indicate so...)
https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/examples/AspNetCore/Program.cs#L168

@mhdimsy
Copy link
Author

mhdimsy commented Jun 25, 2024

Yes
In startup.cs file this line exist.
Just the first few seconds it works fine, but then it stops sending.
please see the image
image

@mhdimsy
Copy link
Author

mhdimsy commented Jun 25, 2024

FYI:
I activate console exporter
While the console is printing the metrics correctly, the issue I mentioned still exists.

@Kielek
Copy link
Contributor

Kielek commented Jun 25, 2024

@mhdimsy, please give a chance to OpenTelemetry.Exporter.Prometheus.AspNetCore 1.9.0-beta.2. It was released yesterday.

@mhdimsy
Copy link
Author

mhdimsy commented Jun 26, 2024

@Kielek , Thanks it works.
But AddAspNetCoreInstrumentation not has http_server_active_requests metrics, this is correct?

@Kielek
Copy link
Contributor

Kielek commented Jun 26, 2024

@mhdimsy, please check https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Instrumentation.AspNetCore-1.9.0/src/OpenTelemetry.Instrumentation.AspNetCore/README.md#metrics

I am closing this as the issue was solved. Please create separate one if you fins some problems with metrics.

@Kielek Kielek closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants