---
title: "Instrument an application with OpenTelemetry | OpenTelemetry documentation"
description: "Learn how to instrument your application with OpenTelemetry for Application Observability."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Instrument an application with OpenTelemetry

Instrumentation adds code to your application to collect telemetry data. This guide helps you set up OpenTelemetry instrumentation for your application.

## Goal

Add instrumentation to your application to collect metrics, logs, and traces. Send this telemetry data to Grafana Cloud Application Observability or a self-managed backend.

## Prerequisites

- **Access to code**: You can modify or deploy your application code
- **Supported language**: Your application uses Java, .NET, JavaScript, Python, PHP, Go, or another language supported by OpenTelemetry
- **Data destination**: You have access to Grafana Cloud or self-managed Loki, Mimir, or Tempo

> Note
> 
> For Kubernetes deployments, you don’t need direct code access if you use the OpenTelemetry Operator.

## Instrumentation methods

Choose from the following instrumentation approaches:

**Grafana distributions**: OpenTelemetry SDKs from Grafana with additional features

- [Grafana OpenTelemetry Java](./grafana-java/) (JVM agent, no code changes required, includes support for Scala and Kotlin)
- [Grafana OpenTelemetry .NET](./grafana-dotnet/)

**Upstream distributions**: OpenTelemetry SDKs maintained by the community

- [OpenTelemetry JavaScript](/docs/grafana-cloud/monitor-applications/application-observability/instrument/node/)
- [OpenTelemetry Python](/docs/grafana-cloud/monitor-applications/application-observability/instrument/python/)
- [OpenTelemetry PHP](/docs/grafana-cloud/monitor-applications/application-observability/instrument/php/)
- [OpenTelemetry Go](/docs/grafana-cloud/monitor-applications/application-observability/instrument/go/)

**Grafana Beyla**: Auto-instrument applications using eBPF technology

- [Grafana Beyla documentation](./beyla/)
- Works with all languages and frameworks
- Requires no code changes
- Requires Linux with Kernel 5.8 or higher with BPF Type Format (BTF) enabled

**OpenTelemetry Operator**: For Kubernetes deployments

- [OpenTelemetry Operator documentation](/docs/grafana-cloud/monitor-applications/application-observability/instrument/opentelemetry-operator/)
- Injects OpenTelemetry instrumentation into Kubernetes workloads
- Requires no application code changes

## Recommended setup for Grafana Cloud

Grafana Labs recommends that you set up OpenTelemetry components, including instrumentation and an OpenTelemetry Collector distribution, using one of the [Grafana Cloud setup guides](/docs/opentelemetry/grafana-cloud/).

These opinionated guides make it easy to get started. They include all the binaries, configuration, and connection parameters you need to set up OpenTelemetry for [Grafana Cloud](/products/cloud/).

## Comparison of instrumentation methods

Expand table

| Method                      | Code changes             | Language support   | Use case                                                                                                             |
|-----------------------------|--------------------------|--------------------|----------------------------------------------------------------------------------------------------------------------|
| Grafana OpenTelemetry Java  | Not required (JVM agent) | Java               | Offers advanced instrumentation features and Grafana support.                                                        |
| Grafana OpenTelemetry .NET  | Required                 | .NET               | Offers advanced instrumentation features and Grafana support.                                                        |
| Upstream OpenTelemetry SDKs | Required                 | Multiple languages | Provides standard instrumentation with community support.                                                            |
| Grafana Beyla               | Not required             | Any language       | Enables quick setup for any language, supports legacy applications, and requires Linux kernel 5.8+ with BTF enabled. |
| OpenTelemetry Operator      | Not required             | Multiple languages | Manages and injects instrumentation in Kubernetes deployments.                                                       |

## Next steps

After instrumenting your application, you need to configure your data pipeline:

1. [Set up an OpenTelemetry Collector distribution](../collector/) to process and forward telemetry data, or
2. [Send OTLP formatted telemetry data directly to a backend](../ingest/) without using an OpenTelemetry Collector

When your data pipeline is configured, you can:

- Create dashboards in Grafana to visualize your application metrics
- Set up alerts for performance issues and anomalies
- Use Explore to investigate traces and logs
- Analyze application performance with Grafana Application Observability
