Menu
Grafana Cloud

Send data using OpenTelemetry Protocol (OTLP)

Note: We currently do not provide a service level agreement (SLA).

In this guide, you’ll learn how to send data through OTLP to Grafana Cloud. You can send telemetry data in two ways:

  • Using the OpenTelemetry Collector
  • Using OpenTelemetry SDKs to instrument your application

Before you begin

  • Instrument an application with OpenTelemetry SDKs or install the OpenTelemetry Collector.
  • Open the Cloud Portal, and click Details to make note of the instance ID and the zone.
Note:

This feature is currently supported in the following GCP regions:

  • Australia (prod-au-southeast-0)
  • Belgium (prod-eu-west-0)
  • Brazil (prod-sa-east-0)
  • India (prod-ap-south-0)
  • Singapore (prod-ap-southeast-0)
  • UK (prod-gb-south-0)
  • US Central (prod-us-central-0)

The following AWS regions are also covered:

  • Canada (prod-ca-east-0)
  • Germany (prod-eu-west-2)
  • US Central (prod-us-east-0)

The following Azure regions are also covered:

  • Netherlands (prod-eu-west-3)
  • US Central (us-central2)

We plan to add more regions. If you’d like to request a region, contact Grafana support and we’ll prioritize your request.

  • Create an Access Policy token with the metrics:write scope.
  • Make note of the following values that you’ll need in order to write OLTP:
    • OTLP Endpoint URL: https://otlp-gateway-<zone>.grafana.net/otlp (ex: https://otlp-gateway-prod-us-central-0.grafana.net/otlp).
    • Basic Auth Username: <instanceID from Grafana details page>
    • Basic Auth Password: <Cloud Access Policy token>

Examples in this topic

The examples in this topic are based on the following Grafana Cloud instance.

Grafance Cloud instance example

Push using the OpenTelemetry Collector

To export to Grafana Cloud, add the otlphttp exporter with a basicauth extension to the collector.

Note: To use the basicauth extension, choose a suitable collector distribution that contains the extension, such as otelcol-contrib.

The following sample shows how to add the otlphttp exporter to the collector. Using the example image above, the instanceID is 130834 and the endpoint is https://otlp-gateway-prod-us-central-0.grafana.net/otlp.

yaml
extensions:
  basicauth/otlp:
    client_auth:
      username: <instanceID>
      password: <Cloud Access Policy token>

exporters:
  otlphttp:
    auth:
      authenticator: basicauth/otlp
    endpoint: https://otlp-gateway-<zone>.grafana.net/otlp

service:
  extensions: [basicauth/otlp]
  pipelines:
    metrics:
      receivers: [...]
      processors: [...]
      exporters: [..., otlphttp]
    traces:
      receivers: [...]
      processors: [...]
      exporters: [..., otlphttp]
    logs:
      receivers: [...]
      processors: [...]
      exporters: [..., otlphttp]

Push directly from applications using the OpenTelemetry SDKs

In typical OTel architectures, the applications write to the collector, and the collector writes to Grafana Cloud. We recommend using the collector in the pipeline where possible because it enables you to batch, aggregate, clean up, and route the data.

However, if you want bypass the collector, you can configure the OpenTelemetry SDKs to use environment variables to push directly to Grafana Cloud.

  • OTEL_EXPORTER_OTLP_PROTOCOL needs to be set to http/protobuf
  • OTEL_EXPORTER_OTLP_ENDPOINT should be set to https://otlp-gateway-<zone>.grafana.net/otlp
  • OTEL_EXPORTER_OTLP_HEADERS should be set to Basic <base64 instanceID:token>

For example:

export GRAFANA_INSTANCE_ID="130384"
export TOKEN="abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc="


export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp-gateway-prod-us-central-0.grafana.net/otlp"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic $(echo -n $GRAFANA_INSTANCE_ID:$TOKEN | base64 -w 0)"

See OTLP format considerations for information about metrics and logs conversion.