Send data to the Grafana Cloud OTLP endpoint
The Grafana Cloud OTLP endpoint is OpenTelemetry Protocol (OTLP) compliant, and the recommended endpoint to send OpenTelemetry metrics, logs, and traces to Grafana Cloud.
Recommended production architecture
The recommended architecture for supported production observability is to send OTLP data via Grafana Alloy, Grafana Labs’ distribution of the OpenTelemetry Collector.
The recommended OpenTelemetry architecture uses Grafana Alloy.
Grafana Alloy offers the following advantages over non-Collector setups:
- Robust, reliable, and scalable to handle transport issues.
- Support to enrich telemetry metadata data, for example to add
k8s.*
attributes. - Support to sample and redact data, and route data to multiple observability backends.
Note
You can use other OpenTelemetry Collector distributions but may need to perform additional set up and maintenance.
Quickstart architecture
For non-production observability, such as local development or test purposes, or when it isn’t possible to deploy an OpenTelemetry Collector distribution, use OpenTelemetry instrumentation SDKs to send OTLP data directly to the OTLP endpoint.
You can use a language specific instrumentation agent or SDK for automatic or manual instrumentation with full support to send OTLP metrics, logs, and traces.
A quickstart architecture that uses language specific agents or SDKs.
Alternatively you can use Grafana Beyla auto-instrumentation at the kernel level without the need for a language specific agent or SDK. Beyla supports Response, Error, and Duration metrics (RED metrics) and distributed traces with some limitations.
A quickstart architecture that uses Grafana Beyla eBPF auto-instrumentation SDK.
The quickstart architecture is easy to set up, however be aware of the following disadvantages compared to Collector-based setups:
- Limited reliability to handle transport issues.
- No support to enrich telemetry metadata data.
- No support to sample and redact data, and route data to multiple observability backends.
Recommended OpenTelemetry setup via Grafana Cloud integrations
For most use cases, Grafana Labs recommends to use the Grafana Cloud integration tiles to setup and send OpenTelemetry data to Grafana Cloud. This opinionated approach includes all the binaries, connection parameters, and configuration snippets you need to set up OpenTelemetry.
Integration tiles are available to guide you to set up a production architecture with:
- Grafana Labs auto-instrumentation agent for Java (JVM) and Grafana Alloy
- Grafana Labs instrumentation SDK for .Net and Grafana Alloy
- Grafana Beyla eBPF auto-instrumentation and Grafana Alloy
- OpenTelemetry (OTLP) with Grafana Alloy, for an application already instrumented with OpenTelemetry
- The upstream OpenTelemetry Collector published by the OpenTelemetry Community, for an application already instrumented with OpenTelemetry
Note
For applications that use programming languages other than Java (JVM) and .NET, follow the Application Observability instrumentation documentation or upstream OpenTelemetry instrumentation documentation to set up manual instrumentation, then use the Grafana Alloy or upstream OpenTelemetry Collector integration tile to set up a Collector.
To use a Grafana Cloud integration tile to set up OpenTelemetry:
- Sign In to the Grafana Cloud Portal.
- From your organization Overview, select or click Launch to open a Grafana Cloud stack.
- With a stack selected, click Launch from the Grafana tile to go to Grafana Cloud.
- With Grafana Cloud launched, click Connections, or expand, then click Add new connection.
- Search for “OpenTelemetry” and press enter to filter the connection options.
- Select the desired OpenTelemetry integration tile and follow the setup instructions.
Grafana Cloud integration tiles for OpenTelemetry
Manual OpenTelemetry setup for advanced users
Advanced users can manually set up OpenTelemetry components to send OpenTelemetry data to Grafana Cloud.
To send OTLP data to the Cloud OTLP endpoint you need to get your connection details from the Grafana Cloud administration console:
- Sign In to the Grafana Cloud Portal.
- From your organization Overview, select or click Launch to open a Grafana Cloud stack.
- With a stack selected, click Configure from the OpenTelemetry tile.
- Follow the instructions to generate an authentication token and OpenTelemetry environment variables
OTEL_EXPORTER_OTLP_PROTOCOL
,OTEL_EXPORTER_OTLP_ENDPOINT
, andOTEL_EXPORTER_OTLP_HEADERS
.
Configure the OTLP endpoint for a Grafana Cloud stack.
Note
If you use Python, replace “Basic " in your connection variables shell script with “Basic%20”.
Set up instructions are available for:
- Grafana Beyla, a low-touch eBPF auto-instrumentation solution
- Language specific OpenTelemetry agents and SDKs for JVM (Java, Scala, or Kotlin), .Net, Node.js, Python, PHP, and Go
- Grafana Alloy, Grafana Labs’ distribution of the OpenTelemetry Collector
- Grafana Kubernetes Monitoring Helm Chart based on Grafana Alloy
- The upstream OpenTelemetry Collector and the OpenTelemetry Operator for Kubernetes, published by the OpenTelemetry community
OpenTelemetry environment variables
The OpenTelemetry instrumentation SDKs and agents use the following environment variables to send information about your applications to Grafana Cloud.
Customize the following shell script template to set environment variables and their fields:
export OTEL_SERVICE_NAME=<< SERVICE >>
export OTEL_RESOURCE_ATTRIBUTES=deployment.environment=<< ENVIRONMENT >>,service.namespace=<< NAMESPACE >>,service.version=<< VERSION >>,service.instance.id=<< ID >>
Add each value after the equals replacing the placeholder << ... >>
and remove any optional fields you don’t use. The OTEL_RESOURCE_ATTRIBUTES
contains a comma separated list of field value pairs.
The OTEL_SERVICE_NAME
is a required unique service identifier. A default value is often auto-discovered by the instrumentation. For example, ads
or cart
. You can optionally set the service name as a resource attribute, see below.
OTEL_RESOURCE_ATTRIBUTES field | Description | Example value |
---|---|---|
service.name | Required unique service identifier. Alternatively, set the OTEL_SERVICE_NAME env var.Default often auto-discovered by the instrumentation. | ads , cart |
service.version | Optional service version. Default often auto-discovered by the instrumentation. | 1.0.0 , 1.2.0 beta 3 |
service.instance.id | Optional unique instance id. Default often auto-generated UUID by the instrumentation. | Pod name |
service.namespace | Optional organization-level identifier to group multiple services under. | android , shop |
deployment.environment | Optional organization-level unique deployment environment identifier. | staging , production |
Visualize and use OpenTelemetry data
Grafana Cloud provides a turnkey experience for application performance monitoring (APM) through Grafana Application Observability. It can detect anomalies, identify root causes, and fix problems in services and applications.
Alternatively, you can consume your OpenTelemetry traces, metrics, and logs through Tempo traces, Prometheus/Mimir metrics, and Loki logs visualization. Then use your ingested OpenTelemetry data in Alerting and with all of the analysis features Grafana provides.
OpenTelemetry data format mapping to Grafana Cloud
Refer to OTLP format considerations for information about conversion of OpenTelemetry metrics, logs, and traces to Prometheus/Mimir, Loki, and Tempo.