Instrumentation with Prometheus

The ecosystem around Docker is very large and active, taking advantage of the open standards and extensibility of the platform. As the ecosystem has matured, a few technologies have emerged as strong candidates for inclusion in almost all Dockerized applications.

Prometheus is an open source monitoring solution. It's a flexible component that you can use in different ways, but the typical implementation is to run a Prometheus server in a Docker container, configured to read instrumentation endpoints that you make available in your other Docker containers.

You configure Prometheus to poll all the container endpoints and it stores the results in a time-series database. You can add a Prometheus endpoint to your application by simply adding a REST API, which responds to GET requests from the Prometheus server with a list of the metrics you're interested in collecting.

For .NET Framework and .NET Core projects, there is a NuGet package that does this for you, that is, adding a Prometheus endpoint to your application. It exposes a useful set of metrics by default, including the values of key .NET statistics and Windows performance counters. You can add Prometheus support directly to your application or you can run a Prometheus exporter alongside your app.

The approach you take will depend on the type of application you want to instrument. If it's a legacy .NET Framework app that you're moving to Docker, you can add basic instrumentation by packaging a Prometheus exporter in the Docker image, and that will give you metrics about your application without you needing to change code. For new applications, you can write code to expose specific application metrics to Prometheus.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.233.43