Daemon/Background service metrics #4630
Replies: 3 comments
-
I have the same question. What approach can we follow when creating background worker services? Any news? |
Beta Was this translation helpful? Give feedback.
-
If you are using an Asp.Net Core web app with some background worker in it (i.e same process), then the existing Prometheus.AspNetCore can be used. If you are running a pure worker service which do not by itself run a webserver, then you are limited to using OTLP Exporter only. (unless you want to upgrade it to a webserver, at which point its no diff. than regular asp.net core webhost) The warning in Prometheus.HttpListener is true, and already suggests the approach of using OTLP+collector->prometheus |
Beta Was this translation helpful? Give feedback.
-
Absolutely! To expose Prometheus metrics for scraping from a background worker service, you might consider using the OpenTelemetry.Exporter.Prometheus.HttpListener package. Despite the mention of no plans for production, it could still be a viable approach for your use case. Here's a simplified example of integrating it into your existing worker service: `public class Program
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
We're collecting metrics from our dotnet Web APIs using the Open Telemetry package OpenTelemetry.Exporter.Prometheus.AspNetCore, which we're initialising at startup with a call to
UseOpenTelemetryPrometheusScrapingEndpoint
to expose Prometheus metrics for scraping - this is deployed on Azure Kubernetes Service. All is good - metrics are exposed on the port we configure inUseOpenTelemetryPrometheusScrapingEndpoint
.We also have a number of Daemon processing jobs (message processors and other event triggered background jobs) we'd like to expose metrics for scraping.
Is there a recommended package/approach/example for exporting Prometheus metrics for scraping from a Background worker service? Example skeleton code of the type of app we'd be building.
The package OpenTelemetry.Exporter.Prometheus.HttpListener does what I want, e.g. just call
and that would expose that endpoint which could be scraped. However, the statement in the package page about no plans for production & mentioning different packages is making me question if this is the correct approach.
Beta Was this translation helpful? Give feedback.
All reactions