Instrument applications for tracing
To send distributed traces to Grafana Cloud, instrument your applications using OpenTelemetry (OTel) or instrumentation options such as Grafana Beyla. You can also use manual instrumentation to create spans and traces.
For additional information, refer to About instrumentation.
OpenTelemetry SDKs
OpenTelemetry provides language-specific SDKs and auto-instrumentation libraries.
- Overview and language guides: OpenTelemetry instrumentation
- Specification: OpenTelemetry specification
Common patterns:
- Set a stable service name (resource attribute
service.name). - Enable context propagation across services (for example, W3C TraceContext).
- Export via OTLP (HTTP or gRPC) to a local collector such as Grafana Alloy or OpenTelemetry Collector.
Auto-instrumentation
Auto-instrumentation can discover common frameworks/libraries and emit spans without code changes.
- Java agent: OpenTelemetry Java instrumentation
- Kubernetes OpenTelemetry Operator (auto-injection): OpenTelemetry Operator
Notes:
- Auto-instrumentation coverage varies by language and framework.
- You can combine auto-instrumentation with manual spans for critical paths and business events.
Grafana Beyla
Grafana Beyla is an eBPF-based application zero-code instrumentation tool to get started with Application Observability. Beyla uses eBPF to automatically inspect application executables and the OS networking layer, and capture trace spans related to web transactions and Rate Errors Duration (RED) metrics for Linux HTTP/S and gRPC services. All data capture occurs without any modifications to application code or configuration.
Refer to Set up Beyla for information about how to instrument using Beyla.
- Captures HTTP/gRPC metadata, latency, and error information.
- Works alongside OpenTelemetry; you can forward traces via OTLP to Alloy or the OTel Collector.
Note
While Beyla is a good choice for metrics, span metrics, and service graphs, if you choose to use it for tracing, check the Distributed traces with Beylato verify that it meets your tracing needs.
Minimal checklist
- Choose instrumentation:
- OTel SDK (manual + auto-instrumentation) or
- Beyla (auto-instrumentation on Linux)
- Set
service.nameand other resource attributes (for example, environment, version). - Export traces using OTLP to a local collector:
- Grafana Alloy (preferred) or OpenTelemetry Collector.
- In your collector, forward traces to Grafana Cloud Traces.
- Verify traces in Grafana (Explore → TraceQL/Search).
Next steps
- Set up a collector: Set up tracing
- Send traces with Grafana Alloy: Set up Grafana Cloud Traces using Grafana Alloy
- Learn to query with TraceQL: Query tracing data



