---
title: "Instrument and test your application | Grafana Labs"
description: "Install Beyla, configure it with your OTLP credentials, and instrument your application"
---

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

# Instrument and test your application

In this milestone, you instrument an application using Beyla running in a Docker container. You can use your own application, or if you don’t have one, use the sample application provided.

To instrument an application with Beyla, complete the following steps:

You’ll start an application, run Beyla beside it, and generate traffic so Beyla can emit traces.

1. Start the application you want to instrument. If you don’t have an application, run the following command to start a sample Go blog application:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   docker run --rm -d \
     --name goblog \
     -p 8443:8443 \
     mariomac/goblog:dev
   ```
   
   The sample application runs in the background and listens on port `8443`.
2. Set your OTLP environment variables. Run the following commands, replacing the placeholders with the values you saved in the previous milestone:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
   export OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp-gateway-prod-<REGION>.grafana.net/otlp"
   export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic <YOUR_CREDENTIALS>"
   ```
3. Run the following command to start Beyla as a sidecar container. If you’re using your own application, replace `container:goblog` with `container:<YOUR_CONTAINER_NAME>` and `BEYLA_OPEN_PORT=8443` with your application’s port:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   docker run --rm \
     --pid="container:goblog" \
     --privileged \
     -e BEYLA_OPEN_PORT=8443 \
     -e BEYLA_TRACE_PRINTER=text \
     -e OTEL_EXPORTER_OTLP_PROTOCOL \
     -e OTEL_EXPORTER_OTLP_ENDPOINT \
     -e OTEL_EXPORTER_OTLP_HEADERS \
     grafana/beyla:latest
   ```
   
   Beyla requires administrative privileges. Ensure you have the necessary permissions to run Docker containers with `--privileged`.
4. Open a new terminal window and generate application traffic from a browser or terminal. If using your own application, make a request to its listening port using the appropriate protocol. For example, for an HTTP application:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   curl http://localhost:<YOUR_PORT>/
   ```
   
   If using the sample application, run the following command:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   curl -k https://localhost:8443/
   ```
5. Return to the terminal window where Beyla is running and verify the trace output. You should see output similar to the following:
   
   text ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```text
   2026-02-02 14:03:53 (19.06ms) [200] GET /
   ```
   
   This output confirms that Beyla intercepted the request and generated a trace.

You now have a running application with Beyla generating trace data from real requests.

In the next milestone, you explore the distributed traces in Grafana Cloud.

* * *

### Troubleshooting

Explore the following troubleshooting topics if you need help:

- [Run Beyla as a Docker container](/docs/beyla/latest/setup/docker/)
- [Beyla security, permissions, and capabilities](/docs/beyla/latest/security/)
- [Configure Beyla options](/docs/beyla/latest/configure/options/)
