How does OpenTelemetry eBPF Auto-Instrumentation trace microservices without code changes?
❓ Interview Prompt: Explain OpenTelemetry eBPF agent uprobes, auto-injected sidecar instrumentation, zero-code distributed tracing, and context propagation across services.
Traditional distributed tracing requires manual instrumentation — developers add SDK calls to each service. At scale, this is impractical and inconsistent. eBPF Auto-Instrumentation extracts traces without any code changes.
Two Approaches to Auto-Instrumentation:
#### 1. OpenTelemetry Operator (Sidecar Injection):
@opentelemetry/auto-instrumentations-node.opentelemetry-javaagent.jar via JAVA_TOOL_OPTIONS.#### 2. Beyla / Coroot eBPF (Zero-Restart):
Context Propagation:
Auto-instrumented services must propagate W3C TraceContext (traceparent) headers. eBPF agents automatically add/read these headers at the HTTP client/server boundaries.
Code Implementation Example
# OTel Operator: auto-instrument Node.js pods via annotation
# First install OTel Operator via Helm
# helm install opentelemetry-operator open-telemetry/opentelemetry-operator
# Instrumentation CRD: defines how to instrument Node.js apps
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: nodejs-instrumentation
spec:
exporter:
endpoint: http://otel-collector:4317 # OTLP gRPC endpoint
propagators:
- tracecontext # W3C TraceContext headers
- baggage
nodejs:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:latest
env:
- name: OTEL_SERVICE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.labels['app']
---
# Pod annotation triggers automatic sidecar injection
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
template:
metadata:
annotations:
instrumentation.opentelemetry.io/inject-nodejs: "nodejs-instrumentation"
# No code changes needed! OTel operator injects the agent automaticallyOTel Operator auto-injects language agents via mutating webhook (annotation-based); eBPF agents (Beyla) instrument at syscall level without any restart. Both enable zero-code distributed tracing.