Add OpenTelemtry eBPF auto-instrumentation support#1022
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds optional Grafana Beyla eBPF auto-instrumentation to the LGTM container image and local run scripts, allowing traces/metrics to be sent to the existing OpenTelemetry Collector (127.0.0.1:4318) without changing collector config.
Changes:
- Add Beyla binary/config/scripts into the Docker image and start Beyla optionally in
run-all.shwhenENABLE_BEYLA=true. - Update
run-lgtm.sh/run-lgtm.ps1to auto-add--pid=host --privilegedand forward Beyla-related env vars when enabled. - Document Beyla usage and add a
misetask for quick startup.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| run-lgtm.sh | Adds opt-in Beyla enablement logic, env forwarding, and conditional TTY behavior. |
| run-lgtm.ps1 | Adds opt-in Beyla enablement logic and env forwarding for Windows/PowerShell runs. |
| mise.toml | Adds lgtm-beyla task to run LGTM with Beyla enabled. |
| docker/run-beyla.sh | New entrypoint script to run Beyla with target/port-based discovery defaults. |
| docker/run-all.sh | Starts Beyla optionally and adds non-blocking status messaging. |
| docker/download-beyla.sh | Downloads/extracts Beyla during the image build. |
| docker/beyla-config.yaml | Configures Beyla OTLP HTTP export to the existing collector and enables internal metrics. |
| docker/Dockerfile | Adds Beyla version ARG, downloads Beyla, and includes Beyla scripts/config in the image. |
| README.md | Documents how to enable/configure Beyla and adds logging env var. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@martincostello please check again |
|
Will convert to use OBI: there's probably no strong reason to choose Beyla over upstream OBI at this point, and it may be worth switching. Here's the situation: Beyla is now a thin wrapper around OBI Grafana https://grafana.com/blog/2025/05/07/opentelemetry-ebpf-instrumentation-beyla-donation/ as the OpenTelemetry eBPF Instrumentation (OBI) project. The relationship is:
All current Beyla maintainers work full-time on the upstream repo, and PRs (unless docs-only) are expected to go to OBI, not Beyla. Arguments for using OBI instead
Arguments for keeping Beyla (weaker)
My take For a project named docker-otel-lgtm that's meant to be a vendor-neutral OpenTelemetry dev/demo stack, OBI would be the more natural fit — unless it's still too early in its Sources:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3a41b9a to
6c9ccb1
Compare
grcevski
left a comment
There was a problem hiding this comment.
Looking great! I'd just enable context propagation by default. If it's not supported by the kernel, we will gracefully degrade to black-box context propagation.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove OBI references (not yet in repo, coming via PR #1022) - Remove nonexistent `mise run lgtm-obi` command - Fix cosign claim: only OTel Collector uses cosign, others use SHA256 - Fix docker-compose filenames to match actual `docker-compose.oats.yml` - Fix collector config filenames and otelcol-contrib invocation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 30 changed files in this pull request and generated 6 comments.
Files not reviewed (1)
- examples/obi/nodejs/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
already has command for #1022 --------- Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
## Summary - Replace the `include:` directive with multiple `-f` flags when merging docker-compose files - The `include:` approach treats each file as an independent project, preventing service name overrides across files (fails with `services.lgtm conflicts with imported resource`) - Multiple `-f` flags allow later files to merge into services defined by earlier files - Add `--project-directory` based on the first user compose file so that relative paths (build contexts, dockerfiles) resolve correctly ## Motivation This is needed for [docker-otel-lgtm OBI support](grafana/docker-otel-lgtm#1022), where the OATS compose file must override the `lgtm` service to add `privileged: true`, `pid: "host"`, and `ENABLE_OBI: "true"` for eBPF instrumentation. ## Test plan - [x] Verified OBI example (`oats examples/obi`) passes with this change - [x] Verified existing Go example generates identical compose output (no regression)
9eb7366 to
1c14057
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 30 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- examples/obi/nodejs/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
16d5ed9 to
1c14057
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 32 changed files in this pull request and generated 4 comments.
Files not reviewed (1)
- examples/obi/nodejs/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Include the Beyla binary in the image (opt-in via ENABLE_BEYLA=true). When enabled, run-lgtm.sh/ps1 auto-add --pid=host --privileged flags. Beyla sends traces and metrics to the existing OTel Collector at 127.0.0.1:4318, requiring no collector config changes. Beyla is excluded from the main health check loop so it fails gracefully when eBPF capabilities are unavailable.
…n (OBI) Beyla's core has been donated to the OpenTelemetry project as OBI. Since this repo is a vendor-neutral OpenTelemetry stack, using the upstream project is a better fit. Key changes: - Multi-stage COPY from otel/ebpf-instrument image instead of downloading Beyla release tarballs - Env vars: BEYLA_TARGET → OBI_TARGET, BEYLA_EXECUTABLE_NAME → OTEL_EBPF_AUTO_TARGET_EXE, BEYLA_OPEN_PORT → OTEL_EBPF_OPEN_PORT - Config: internal_metrics.prometheus.port → prometheus_export.port/path - Remove download-beyla.sh (binary comes from container image)
Demonstrates OBI automatically instrumenting 5 apps (Java, Go, Python, Node.js, .NET) without any OpenTelemetry SDK, agent, or code changes. Java and Python reuse existing source with Dockerfiles that strip OTel layers. Go, Node.js, and .NET have new minimal source with zero OTel dependencies. The lgtm container runs with ENABLE_OBI, privileged mode, and host PID namespace to allow eBPF kernel-level instrumentation.
- Fix lgtm-obi --local ignoring the tag argument - Add comment explaining why examples/obi/go/ is excluded from super-linter - Clarify that OTLP exporter vars are forwarded via --env-file .env
- Fix shadow warning in otel.go (rename inner err to errs) - Fix empty-block warning in rolldice.go (nolint:revive) - Remove deprecated otelhttp.WithRouteTag (auto-extracted since Go 1.22+) - Add examples/obi/go to go.work so golangci-lint can typecheck it - Suppress gosec warnings in OBI Go demo (dice roll, simple server) - Switch from VALIDATE_GO_MODULES=false to VALIDATE_GO=false (GO_MODULES no longer times out; non-module GO can't handle two modules) - Remove FIX_GO=true (incompatible with VALIDATE_GO=false)
- Add ebpf context_propagation: all to OBI config (grcevski) - Add Pyroscope port 4040 to OBI docker-compose example - Fix PowerShell runner: conditional TTY allocation like bash runner - Fix OBI nodejs Dockerfile: use npm ci with lockfile and non-root user - Fix OBI go.mod: use go 1.24.0 for consistency with go.work - Fix generate-traffic Dockerfile: clean up apt lists
Required for OBI acceptance tests to pass.
- Add *.cs eol=crlf to .gitattributes for editorconfig compliance - Regenerate renovate-tracked-deps.json with OBI entries - Remove ebpf.context_propagation from obi-config.yaml (needs kernel 5.17+) - Enable OBI logging in oats test compose for debugging
5144fc1 to
cc1beab
Compare
Per reviewer feedback, ebpf.context_propagation: all enables distributed trace propagation and falls back gracefully on unsupported kernels.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 31 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- examples/obi/nodejs/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix grep portability: use grep -vE instead of GNU-specific \| alternation - Drop -i flag when stdin is not a TTY (bash and PowerShell) - Add comment explaining why oats.yaml has no input section - Fix OBI documentation link to point to opentelemetry.io
Summary
OBI Integration (docker/)
OBI Multi-App Example (examples/obi/)
Runs all 5 language examples without any OpenTelemetry instrumentation — OBI discovers and instruments them automatically via eBPF:
Test plan