Skip to content

Latest commit

 

History

History
19 lines (10 loc) · 2 KB

Metrics.md

File metadata and controls

19 lines (10 loc) · 2 KB

Metrics

Scaffold uses OpenTelemetry for application metrics and can be configured to send metrics to an OpenTelemetry collector or directly to your backend of choice. Using an OpenTelemetry collector is recommended as it allows you to keep Scaffold abstracted away from your metrics backend.

For local development, Scaffold has been configured to send metrics to an OpenTelemetry collector which is then scraped by a local Prometheus instance. You can view the metrics at http://localhost:9090/graph. It is also possible to view the metrics in the local Grafana instance at http://localhost:3000.

For more details about using OpenTelemetry in .NET, please check out the OpenTelemetry .NET project.

Instrumenting Code

To instrument your code with metrics, you can use the native .NET Metrics API. For for more information on how to instrument code for OpenTelemetry, please refer to documentation in the OpenTelemetry .NET API.

Meter Provider

An internal static MeterProvider has been provided in Scaffold to help you instrument the application layer. This MeterProvider, which is distinct from the OpenTelemetry MeterProvider, holds the static instance of a Meter for the application layer.

Event Counter

Included in the application layer of Scaffold is an EventCounter that counts all the messages that pass through the in-process event bus. Rather than littering the codebase with counters, developers can simply publish an event and it will be counted with all the other events of the same type and emitted as a metric.