This 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 --prerelease 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 OTel 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_HEADERS
.
For details on how to obtain those values, refer to Push directly from applications using the OpenTelemetry SDKs.
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp-gateway-prod-eu-west-0.grafana.net/otlp"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic a-secret-token"
For detailed documentation and setup instructions, refer to the following documents:
- Installation
- Configuration
- Supported instrumentations
- Supported resource detectors
- Migrating to upstream
This project utilizes the self-diagnostics feature of the .NET OpenTelemetry SDK.
To enable self-diagnostics, go to the
current working directory of
your process and create a configuration file named OTEL_DIAGNOSTICS.json
with
the following content:
{
"LogDirectory": ".",
"FileSize": 32768,
"LogLevel": "Warning"
}
To disable self-diagnostics, delete the above file.
To engage with the Grafana Application Observability community:
- Chat with us on our community Slack channel. To invite yourself to the Grafana Slack, visit https://grafana.slack.com/ and join the #application-observability channel.
- Ask questions on the Discussions page.
- File an issue for bugs, issues, and feature suggestions.