RousselTMLEARNING

Observability

Zero-code instrumentation with Grafana Beyla (OpenTelemetry eBPF Instrumentation)

Get RED metrics and HTTP/gRPC traces from any application without changing it: Grafana Beyla and OpenTelemetry eBPF Instrumentation, configuration, Prometheus and OTLP export, Kubernetes.

1. The principle #

RED metrics for any service.

What Beyla does #

Available in: ✓ OSS ✓ Enterprise ✓ Cloud Beyla open source; built into Alloy and Grafana Cloud Application Observability

How Beyla works
No library to add, no application restart.

Beyla attaches to the targeted processes and observes their HTTP, HTTP/2, gRPC, SQL, Redis or Kafka requests (server and client side). From them it derives RED metrics (Rate, Errors, Duration) and spans in OpenTelemetry format.

Good to know: In 2025, Grafana Labs donated Beyla's core to the OpenTelemetry project under the name OpenTelemetry eBPF Instrumentation (OBI). Beyla remains Grafana's distribution, with the same configuration; Alloy embeds it in the beyla.ebpf component.

2. Configuring Beyla #

Targeting, exporting.

Environment variables #

docker run --rm --privileged --pid=host \
  -e BEYLA_OPEN_PORT=8080 \
  -e BEYLA_PROMETHEUS_PORT=9400 \
  -e OTEL_EXPORTER_OTLP_ENDPOINT=http://alloy:4318 \
  -e BEYLA_TRACE_PRINTER=text \
  grafana/beyla:latest
VariableRole
BEYLA_OPEN_PORTInstrument the process listening on this port
BEYLA_EXECUTABLE_NAMEOr target by executable name
BEYLA_PROMETHEUS_PORTExpose metrics on /metrics
OTEL_EXPORTER_OTLP_ENDPOINTSend metrics and traces over OTLP
BEYLA_TRACE_PRINTERPrint spans to the console (diagnostics)
OTEL_SERVICE_NAMEForce the service name

Configuration file #

# beyla.yml
discovery:
  instrument:
    - open_ports: 8080-8089
    - exe_path: "*/java"
routes:
  patterns: [/api/orders/{id}, /api/users/{id}]   # éviter la cardinalité des URL
  unmatched: heuristic
prometheus_export:
  port: 9400
otel_traces_export:
  endpoint: http://tempo:4318
Common mistake: Without routes, every distinct URL (/orders/123, /orders/124...) can become a label value. Declare route templates or let the heuristic group them.

3. Metrics and traces produced #

OpenTelemetry conventions.

Metrics #

Prometheus metricContent
http_server_request_duration_secondsDuration of received HTTP requests (histogram)
http_client_request_duration_secondsDuration of outgoing HTTP requests
rpc_server_duration_secondsDuration of gRPC calls
db_client_operation_duration_secondsDuration of SQL queries
# Taux d'erreurs 5xx par route
sum by (http_route) (rate(http_server_request_duration_seconds_count{http_response_status_code=~"5.."}[5m]))
/ sum by (http_route) (rate(http_server_request_duration_seconds_count[5m]))

On the trace side, Beyla propagates the W3C context (traceparent) for several languages, enabling distributed traces between services instrumented with eBPF.

Good practice: Start with Beyla to cover all services in a day, then add an OpenTelemetry SDK where you need detailed business spans.

4. On Kubernetes #

DaemonSet and discovery.

Helm #

helm install beyla grafana/beyla -n beyla --create-namespace -f values.yaml
# values.yaml (extrait)
config:
  data:
    discovery:
      instrument:
        - k8s_namespace: boutique
    attributes:
      kubernetes: { enable: true }
    prometheus_export: { port: 9090, path: /metrics }

Beyla adds Kubernetes metadata (namespace, pod, deployment) to metrics and traces: they serve as the default service_name.

Related articles

eBPF explained: programs in the Linux kernel to observe without instrumenting

What eBPF is, how a program is verified and then run in the kernel, hook points (kprobes, uprobes, tracepoint…

Diagnosing with bpftrace and the bcc tools

Everyday eBPF diagnostic tools: bpftrace one-liners (system calls, files, latencies), bcc tools (execsnoop, o…

Observing the Kubernetes network with Cilium Hubble

Make a Kubernetes cluster's network flows visible with Cilium Hubble: architecture, the hubble observe CLI, g…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!