Grafana Cloud

Application Observability .NET quickstart

Quickly get started with Application Observability for .Net with these easy three steps.

  1. Download the instrumentation agent
  2. Instrument an application
  3. Observe the service in Application Observability

Install the agent

Install the Grafana OpenTelemetry Distribution for .Net.

To install the distribution with the full set of dependencies, add a reference to the Grafana.OpenTelemetry package to a project.

dotnet add package --prerelease Grafana.OpenTelemetry

Instrument an application

The UseGrafana extension method on the TracerProviderBuilder or the MetricProviderBuilder can be used to set up the Grafana distribution. By default, telemetry data is sent to a Grafana agent or an OTel collector that runs locally and listens to default OTLP ports:

using OpenTelemetry;
using OpenTelemetry.Trace;
using Grafana.OpenTelemetry;

public class Program
    public static void Main(string[] args)
        using var tracerProvider = Sdk.CreateTracerProviderBuilder()

Login to Grafana Cloud and follow the following instructions to obtain the necessary information to send telemetry data to Grafana Cloud:

  1. Click Details in the Grafana section on
  2. Copy Instance ID and Zone into the command below.
  3. On the left menu, click on Security and then on API Keys
  4. Click on Create API Key (MetricsPublisher role) and copy the key into the command below
  5. Choose a Service Name to identify the service (e.g. cart)
  6. Optionally, add attributes to filter data:
    • deployment.environment: Name of the deployment environment (staging or production)
    • service.namespace: A namespace to group similar services (e.g. shop would create shop/cart in Application Observability)
    • service.version: The application version, to see if a new version has introduced a bug
    • The unique instance, for example the Pod name (a UUID is generated by default)

Make the following environment variables available to the .NET application:

export OTEL_SERVICE_NAME=<Service Name>
export OTEL_RESOURCE_ATTRIBUTES=deployment.environment=<Environment>,service.namespace=<Namespace>,service.version=<Version>

Finally, make some requests to the service to validate data is sent to Grafana Cloud. It might take up to five minutes for data to appear.

Observe the service

In Grafana Cloud, replace the path of the URL with /a/grafana-app-observability-app/services or:

  1. Click on the menu icon in the top left corner
  2. Open the Observability menu
  3. Click on Application

Important: refer to the troubleshooting guide if there is no data in Application Observability.

For a detailed description of all supported installation and configuration options, refer to the project documentation.