Minimal Grafana distribution of OpenTelemetry .NET
$ dotnet add package Grafana.OpenTelemetry.BaseThis is a pre-configured and pre-packaged bundle of OpenTelemetry .NET components, optimized for Grafana Cloud Application Observability.
It requires only minimal setup and configuration and makes it very easy to emit OpenTelemetry metrics, logs, and traces from your .NET application.
For installing the distribution with the full set of dependencies, add a
reference to the Grafana.OpenTelemetry package to your project.
dotnet add package Grafana.OpenTelemetry
The UseGrafana extension method on the TracerProviderBuilder or the
MetricProviderBuilder can be used to set up the Grafana distribution. By
default, telemetry data will be sent to Grafana Alloy or an OpenTelemetry collector
that runs locally and listens to default OTLP ports.
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.UseGrafana()
.Build();
Alternatively, you can send telemetry data directly to Grafana Cloud without
involving an agent or collector. This can be configured via the environment
variables OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_ENDPOINT, and
.
OTEL_EXPORTER_OTLP_HEADERSFor details on how to obtain those values, refer to Send data to the Grafana Cloud OTLP endpoint: Quickstart architecture.
For detailed documentation and setup instructions, refer to our documentation.