Skip to content

This repository holds a very simple HTTP API that uses ASP.NET and Giraffe to exemplify the usage of .NET 8 built-in metrics feature

Notifications You must be signed in to change notification settings

64J0/dotnet-builtin-metrics

Repository files navigation

.NET Built-in Performance

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.

Visualize the metrics

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.Ping

Example metrics:

./assets/example-metrics.png

  • It’s probably with some bug since I’m using a pre-release version of the OpenTelemetry.Exporter.Prometheus.AspNetCore package.

About

This repository holds a very simple HTTP API that uses ASP.NET and Giraffe to exemplify the usage of .NET 8 built-in metrics feature

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages