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:
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:
docker run --rm -d \ --name goblog \ -p 8443:8443 \ mariomac/goblog:devThe sample application runs in the background and listens on port 8443.
Set your OTLP environment variables.
Run the following commands, replacing the placeholders with the values you saved in the previous milestone:
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>"Run the following command to start Beyla as a sidecar container:
If you are using your own application, replace
container:goblogwithcontainer:<YOUR_CONTAINER_NAME>andBEYLA_OPEN_PORT=8443with your application’s port.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:latestBeyla requires administrative privileges. Ensure you have the necessary permissions to run Docker containers with
--privileged.This command configures Beyla to inspect the application container, share its PID namespace, and print traces to the console (
BEYLA_TRACE_PRINTER=text).Open a new terminal window.
Generate application traffic from a browser or a terminal.
If using your own application, make a request to its listening port using the appropriate protocol. For example, for an HTTP application:
curl http://localhost:<YOUR_PORT>/If using the sample application, run the following command:
curl -k https://localhost:8443/Return to the terminal window where Beyla is running and verify the trace output.
You should see output similar to the following:
2026-02-02 14:03:53 (19.06ms) [200] GET /This output confirms that Beyla intercepted the request and generated a trace.
In the next milestone, you explore the distributed traces in Grafana Cloud.