Search code examples
prometheusmonitoringasp.net-core-3.1

how to use Prometheus in background service for metrics and monitoring in .NET core console application?


I am doing POC using Prometheus in .net core app. I did not got sufficient information on Prometheus website to get started

a)how to use Prometheus in background service for metrics and monitoring in .NET core console application?

I did for webapi i was able to work on it but didn't got way for background service


Solution

  • Instead of using a background service template use a WebApi template and add the worker in your service collection, easiest way to expose your app metrics. That's how I've been doing it for years, and yes, I bring a lot into the memory space, but I'm pragmatic, if I ever have the chance will explore the real way