RousselTMLEARNING

Observability

Beyla and Alloy: zero-code RED metrics and traces with beyla.ebpf

Enable Beyla eBPF instrumentation in Alloy: service discovery, RED metrics to Mimir, traces to Tempo, required privileges.

1. Instrumenting without changing code #

How Beyla works.

The principle #

Beyla observes HTTP/S, gRPC and SQL calls of Linux services through eBPF probes in the kernel: no SDK, no redeployment. The beyla.ebpf component runs Beyla as an Alloy child process (Beyla v3.38.1 in the current documentation), producing RED metrics (rate, errors, duration) and traces.

Beyla observes services via eBPF and Alloy routes metrics and traces

2. The configuration #

Metrics and traces.

config.alloy #

beyla.ebpf "default" {
  discovery {
    instrument {
      open_ports = "8080,9000-9100"
    }
  }

  metrics {
    features = ["application", "application_service_graph"]
  }

  output {
    traces = [otelcol.processor.batch.default.input]
  }
}

prometheus.scrape "beyla" {
  targets      = beyla.ebpf.default.targets
  honor_labels = true
  forward_to   = [prometheus.remote_write.mimir.receiver]
}

otelcol.processor.batch "default" {
  output {
    traces = [otelcol.exporter.otlp.tempo.input]
  }
}

otelcol.exporter.otlp "tempo" {
  client {
    endpoint = "tempo:4317"
    tls {
      insecure = true
    }
  }
}

prometheus.remote_write "mimir" {
  endpoint {
    url = "http://mimir:9009/api/v1/push"
  }
}

Configuration validated with alloy validate (Alloy v1.21.3, November 2026).

  • discovery.instrument: which processes to instrument, by open ports (open_ports), executable name or Kubernetes selectors.
  • metrics.features: application (RED), application_service_graph, network, application_runtime…
  • targets: Beyla exposes its metrics; prometheus.scrape collects them with honor_labels = true to keep job and instance.
  • output.traces: without it, traces are dropped.
Process selection and metric families

3. Privileges and deployment #

The tricky part.

Required capabilities #

eBPF needs elevated privileges. The documentation recommends running as root with privileged: false and only the needed capabilities, keeping seccomp and AppArmor active:

securityContext:
  privileged: false
  capabilities:
    add: [BPF, NET_ADMIN, NET_RAW, PERFMON, DAC_READ_SEARCH, SYS_PTRACE, CHECKPOINT_RESTORE]
# Kubernetes Pod: hostPID: true and Unconfined AppArmor profile
Not run here. Our test environment cannot load eBPF programs: the configuration was validated with alloy validate, not executed.

Sources #

Related articles

Alloy and the Grafana Labs ecosystem: which component for which tool?

The map of Alloy integrations with Faro, Beyla, k6, Loki, Mimir, Tempo, Pyroscope, Database Observability, Fl…

Faro and Alloy: receiving front-end RUM with faro.receiver

Configure faro.receiver: CORS, API key, rate limiting, source maps, then send browser errors, Web Vitals and …

Database Observability: tracking MySQL and PostgreSQL queries and plans with Alloy

Alloy's database_observability.mysql and .postgres components: collectors, execution plans, locks, sending to…

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!