GrafanaCloud.OpenTelemetry 1.0.0

dotnet add package GrafanaCloud.OpenTelemetry --version 1.0.0
                    
NuGet\Install-Package GrafanaCloud.OpenTelemetry -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GrafanaCloud.OpenTelemetry" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GrafanaCloud.OpenTelemetry" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="GrafanaCloud.OpenTelemetry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GrafanaCloud.OpenTelemetry --version 1.0.0
                    
#r "nuget: GrafanaCloud.OpenTelemetry, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GrafanaCloud.OpenTelemetry@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GrafanaCloud.OpenTelemetry&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=GrafanaCloud.OpenTelemetry&version=1.0.0
                    
Install as a Cake Tool

GrafanaCloud.OpenTelemetry

A zero-boilerplate OpenTelemetry setup for Grafana Cloud in ASP.NET Core applications. Wires traces (Tempo), metrics (Mimir), and logs (Loki) via OTLP with a single method call.


Installation

dotnet add package GrafanaCloud.OpenTelemetry

Configuration

Add the following to your appsettings.json:

"GrafanaCloud": {
  "Endpoint": "https://otlp-gateway-prod-us-east-3.grafana.net/otlp",
  "Headers": "Authorization=Basic <base64-encoded-instanceid:apitoken>",
  "ServiceName": "my-api",
  "ServiceNamespace": "my-org",
  "DeploymentEnvironment": "production"
}
Key Required Default Description
Endpoint Yes Grafana Cloud OTLP gateway base URL. Traces, metrics, and logs paths are appended automatically.
Headers Yes Auth headers sent with every OTLP request.
ServiceName No "unknown-service" Service name reported in Grafana.
ServiceNamespace No "" Service namespace for grouping.
DeploymentEnvironment No ASP.NET Core environment name Sets the deployment.environment resource attribute.

Your Grafana Cloud OTLP endpoint and credentials can be found under Home → Connections → OpenTelemetry in the Grafana Cloud console.


Registration

Zero-config (reads entirely from appsettings.json)

// Program.cs
builder.AddGrafanaCloud();

With custom activity sources

Register your own ActivitySource names so they appear in Grafana Tempo traces:

builder.AddGrafanaCloud(options =>
{
    options.TracingSources = ["MyApp.Auth", "MyApp.Orders", "MyApp.Payments"];
});

With EntityFrameworkCore instrumentation

EF Core instrumentation is opt-in (it is a beta package):

builder.AddGrafanaCloud(options =>
{
    options.UseEntityFrameworkCoreInstrumentation = true;
    options.TracingSources = ["MyApp.Auth", "MyApp.Orders"];
});

Options Reference

Option Type Default Description
Endpoint string "" Grafana Cloud OTLP base URL. Required.
Headers string "" Auth headers for OTLP requests.
ServiceName string "unknown-service" Service name in traces/metrics/logs.
ServiceNamespace string "" Service namespace.
DeploymentEnvironment string? ASP.NET Core env Sets deployment.environment resource attribute.
TracingSources IList<string> [] Custom ActivitySource names to include in traces.
UseEntityFrameworkCoreInstrumentation bool false Enable EF Core tracing (opt-in).
SuppressFrameworkLogs bool true Suppress noisy EF Core and ASP.NET Core log categories.

What gets wired up

Signal Instrumentation
Traces ASP.NET Core, HttpClient, custom activity sources, optionally EF Core
Metrics ASP.NET Core, HttpClient, .NET Runtime
Logs All ILogger output via OTLP

Health check (/health) and favicon (/favicon.ico) requests are excluded from traces automatically.


Custom Activity Sources

Define your activity sources in your app as usual:

using System.Diagnostics;

public static class MyActivitySource
{
    public static readonly ActivitySource Auth = new("MyApp.Auth");
    public static readonly ActivitySource Orders = new("MyApp.Orders");
}

Then register the names with the library:

builder.AddGrafanaCloud(options =>
{
    options.TracingSources = ["MyApp.Auth", "MyApp.Orders"];
});

Use them in your services:

using var activity = MyActivitySource.Auth.StartActivity("auth.login");
activity?.SetTag("user.id", userId);

Requirements

  • .NET 8
  • ASP.NET Core
  • A Grafana Cloud account with an OTLP endpoint and API token
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 121 3/9/2026