Installation

Install as Agent Plugin Recommended
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install beyla@skills-hub

Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled). Plugin beyla v1.0.0 follows the Agent Plugins spec.

Install with the gh extension
gh skills-hub install beyla

Don't have the extension? Run gh extension install samueltauil/skills-hub first.

Download and extract to your repository:

.github/skills/beyla/

Extract the ZIP to .github/skills/ in your repo. The folder name must match beyla for Copilot to auto-discover it.

Skill Files (3)

SKILL.md 4.1 KB
---
name: beyla
license: Apache-2.0
description: Auto-instrument an application's HTTP / gRPC / DB traffic with Grafana Beyla eBPF — no code changes, no SDK, no restart. Covers requirements (Linux 5.8+ with BTF, CAP_SYS_ADMIN, host PID), language matrix (Go / Java / Python / Ruby / Node / .NET / Rust / C++ / PHP), Docker + Helm + DaemonSet install, port- / process- / Kubernetes-metadata discovery, OTLP traces + Prometheus metrics export, routes decorator (cardinality control), trace sampling, and Grafana Cloud via Alloy. Use when adding observability to a service you can't recompile, instrumenting a closed-source binary, getting RED metrics + spans onto Tempo/Mimir without touching the app, or rolling Beyla as a cluster-wide DaemonSet — even when the user says "zero-code APM", "instrument legacy app", "trace this binary", "eBPF observability", or "no SDK" without naming Beyla.
---

# Grafana Beyla

> **Docs**: https://grafana.com/docs/beyla/latest/

Zero-code HTTP / gRPC / DB instrumentation via eBPF. Emits OTLP traces + Prometheus metrics.

## Prerequisites

- Linux kernel **5.8+** with BTF enabled (`ls /sys/kernel/btf/vmlinux` must exist)
- Root or `CAP_SYS_ADMIN` (or `privileged: true` in Kubernetes + `hostPID: true`)
- x86_64 or ARM64
- An OTLP receiver (Tempo, Alloy, OTel Collector) reachable from Beyla

## Common Workflows

### 1. Instrument a single binary with Docker

```bash
# 1. Run Beyla against the app's port (the app must already be running, listening on 8080)
docker run --privileged --pid=host \
  -v /sys/kernel/debug:/sys/kernel/debug:ro \
  -e BEYLA_OPEN_PORT=8080 \
  -e BEYLA_PROMETHEUS_PORT=8999 \
  -e OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318 \
  -p 8999:8999 \
  grafana/beyla

# 2. Generate some traffic
curl http://localhost:8080/ ; curl http://localhost:8080/api/users/42

# 3. Verify Beyla emitted metrics — should list http_server_request_duration_seconds + counters
curl -s http://localhost:8999/metrics | grep -E '^http_(server|client)_request_duration'

# 4. Verify traces — in Grafana Explore on Tempo, search by service.name (default = process name)
#    Or: query Tempo's search API for spans with service.name="<app>"
```

### 2. Deploy as a cluster-wide DaemonSet

Full DaemonSet + RBAC YAML lives in [`references/kubernetes.md`](references/kubernetes.md). After applying:

```bash
# 1. Verify DaemonSet rollout
kubectl -n monitoring rollout status ds/beyla

# 2. Verify pods are Running, one per node
kubectl -n monitoring get pods -l app=beyla -o wide

# 3. Verify eBPF probes attached (no errors mentioning BTF or "permission denied")
kubectl -n monitoring logs ds/beyla --tail=50 | grep -Ei 'error|fail|btf' || echo "clean"

# 4. Verify telemetry is flowing — check the Tempo/Alloy receiver for spans from the cluster
#    Or scrape one pod directly:
kubectl -n monitoring port-forward ds/beyla 8999:8999 &
curl -s localhost:8999/metrics | head
```

### 3. Send to Grafana Cloud via Alloy

```yaml
# beyla-config.yml
otel_traces_export:  { endpoint: http://alloy:4318 }
otel_metrics_export: { endpoint: http://alloy:4318 }
```

```bash
# Verify Alloy is forwarding — check Alloy UI (localhost:12345) for the
# otelcol.receiver.otlp.beyla component showing received spans/metrics > 0.
```

Full Alloy + Beyla YAML: [`references/config.md`](references/config.md).

## Troubleshooting

- `failed to load BPF object` → kernel < 5.8 or BTF missing; check `/sys/kernel/btf/vmlinux`
- No spans in Tempo, but Prometheus metrics show → check `OTEL_EXPORTER_OTLP_ENDPOINT`, protocol (http vs grpc), and ports (4318 http / 4317 grpc)
- HTTP route cardinality explosion → set `routes.unmatched: heuristic` and add patterns (see [`references/config.md`](references/config.md))
- Pod restarts with `CrashLoopBackOff` → likely missing `hostPID: true` or `privileged: true` / required capabilities

## Resources

- [Beyla docs](https://grafana.com/docs/beyla/latest/)
- [Beyla GitHub](https://github.com/grafana/beyla)
- [`references/config.md`](references/config.md) — full config, env vars, samplers, routes decorator, generated metrics table, runtime matrix
- [`references/kubernetes.md`](references/kubernetes.md) — DaemonSet + RBAC + discovery filters + Helm
references/
config.md 3.2 KB
# Beyla configuration reference

## Full config (YAML)

```yaml
log_level: INFO

discovery:
  services:
    - name: my-app
      open_port: 8080
      # or by process name:
      # exe_path: /usr/bin/myapp
      # or by K8s metadata (auto-detected in K8s)

ebpf:
  wakeup_len: 100              # batch size for events
  track_request_headers: false # HTTP headers — high cardinality risk
  high_request_volume: false   # optimize for high-traffic services

# Distributed tracing output (OTLP)
otel_traces_export:
  endpoint: http://tempo:4318  # HTTP OTLP
  # Or gRPC:
  # endpoint: tempo:4317
  # protocol: grpc

# Metrics output (Prometheus)
prometheus_export:
  port: 9090
  path: /metrics

# Or metrics via OTLP
otel_metrics_export:
  endpoint: http://prometheus-otlp:9090
```

## Environment variables

| Variable | Description |
|----------|-------------|
| `BEYLA_OPEN_PORT` | Port(s) to instrument (e.g. `8080`, `8080-8090`) |
| `BEYLA_EXECUTABLE_NAME` | Process name pattern to instrument |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP endpoint for traces + metrics |
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `grpc` or `http/protobuf` (default) |
| `OTEL_SERVICE_NAME` | Override service name in spans |
| `BEYLA_LOG_LEVEL` | `DEBUG`, `INFO`, `WARN`, `ERROR` |
| `BEYLA_PROMETHEUS_PORT` | Port for Prometheus metrics |
| `BEYLA_PROMETHEUS_PATH` | Default `/metrics` |

## Routes decorator (cardinality control)

```yaml
routes:
  patterns:
    - /user/{id}
    - /api/v1/resources/{resource_id}
  ignored_patterns:
    - /health
    - /metrics
  ignore_mode: traces       # or metrics, both
  unmatched: heuristic      # or path, wildcard, low-cardinality
```

`unmatched` strategies: `heuristic` (numeric-ID replacement, best default), `low-cardinality` (threshold collapse), `wildcard` (`/**`), `path` (real path — explosion risk).

## Trace sampling

```yaml
otel_traces_export:
  sampler:
    name: "parentbased_traceidratio"
    arg:  "0.1"             # 10% — arg is a quoted string
```

Samplers: `always_on`, `always_off`, `traceidratio`, `parentbased_always_on` (default), `parentbased_traceidratio`.

## Generated metrics

| Metric | Type | Description |
|--------|------|-------------|
| `http.server.request.duration` | Histogram | Inbound HTTP duration |
| `http.client.request.duration` | Histogram | Outbound HTTP duration |
| `rpc.server.duration` | Histogram | gRPC server duration |
| `rpc.client.duration` | Histogram | gRPC client duration |
| `db.client.operation.duration` | Histogram | DB query duration |

Labels: `http.method`, `http.route`, `http.response.status_code`, `service.name`, `service.namespace`.

## Supported runtimes

| Language | HTTP | gRPC | DB queries |
|----------|------|------|-----------|
| Go | ✅ | ✅ | ✅ |
| Java (JVM) | ✅ | ✅ | ✅ |
| Python | ✅ | ✅ | - |
| Ruby | ✅ | - | - |
| Node.js | ✅ | - | - |
| .NET | ✅ | ✅ | - |
| Rust | ✅ | ✅ | - |
| C/C++ | ✅ | - | - |
| PHP | ✅ | - | - |

## Grafana Cloud via Alloy

```yaml
otel_traces_export:  { endpoint: http://alloy:4318 }
otel_metrics_export: { endpoint: http://alloy:4318 }
```

```alloy
otelcol.receiver.otlp "beyla" {
  http { endpoint = "0.0.0.0:4318" }
  output {
    traces  = [otelcol.exporter.otlp.grafana_cloud.input]
    metrics = [otelcol.exporter.prometheus.local.input]
  }
}
```
kubernetes.md 1.9 KB
# Beyla on Kubernetes

## DaemonSet (cluster-wide)

```yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: beyla
  namespace: monitoring
spec:
  selector:
    matchLabels: { app: beyla }
  template:
    metadata:
      labels: { app: beyla }
    spec:
      hostPID: true                # required for eBPF
      serviceAccountName: beyla
      containers:
        - name: beyla
          image: grafana/beyla:latest
          securityContext:
            privileged: true       # or specific caps:
            # capabilities: { add: [SYS_ADMIN, SYS_PTRACE, NET_ADMIN] }
          env:
            - { name: BEYLA_OPEN_PORT,             value: "8080" }
            - { name: OTEL_EXPORTER_OTLP_ENDPOINT, value: "http://alloy:4318" }
          volumeMounts:
            - { name: sys-kernel-debug, mountPath: /sys/kernel/debug, readOnly: true }
      volumes:
        - name: sys-kernel-debug
          hostPath: { path: /sys/kernel/debug }
```

## RBAC

```yaml
apiVersion: v1
kind: ServiceAccount
metadata: { name: beyla, namespace: monitoring }
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata: { name: beyla }
rules:
  - apiGroups: [""]
    resources: [nodes, pods, services, endpoints, namespaces]
    verbs: [get, list, watch]
```

## Kubernetes auto-discovery filters

```yaml
discovery:
  services:
    - k8s_namespace: "production"     # all pods in namespace
    - k8s_pod_name: "frontend.*"      # by pod name regex
    - k8s_deployment_name: "api"      # by deployment name
    - open_port: 8080                 # any pod with that port
```

Auto-enriched span attributes:
`k8s.namespace.name`, `k8s.pod.name`, `k8s.node.name`, `k8s.deployment.name`

## Helm install

```bash
helm repo add grafana https://grafana.github.io/helm-charts
helm install beyla grafana/beyla --version 1.16.7 \
  --set discovery.services[0].open_port=8080 \
  --set otelTraces.endpoint=http://tempo:4318
```

License (Apache-2.0)

View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/grafana/skills/blob/main/LICENSE