The idea to create this project was born after watching this video from Nick Chapsas named Measure Your Application’s Performance in .NET. This repository holds a very simple HTTP API that uses ASP.NET and Giraffe to exemplify what are the collected metrics by with built-in .NET feature.
- ASP.NET Core built-in metrics documentation: link.
- Instrumentation documentation: link.
- View metrics in Grafana with OpenTelemetry and Prometheus: link.
One option is to use the dotnet-counters tool.
# restore our dotnet tools
dotnet tool restore
# start the server
dotnet run
# use curl to call the /ping endpoint
# curl localhost:3000/ping
# check Prometheus-style metrics on /metrics endpoint
# in another terminal
# list the process id of the dotnet processes
dotnet dotnet-counters ps
# start monitoring the server process id
dotnet dotnet-counters monitor --process-id <PID> --counters System.Runtime,MyApi.PingExample metrics:
- It’s probably with some bug since I’m using a pre-release version of the
OpenTelemetry.Exporter.Prometheus.AspNetCorepackage.
