自動計装がやってみたくて Run Beyla as a Docker container を試してみたけど、うちの Arch Linux (Kernel 6.18) で全くトレースが表示されなかった問題に遭遇したので Claude と色々やっていたときのメモ。
- Missing telemetry on kernel 6.18.3 open-telemetry/opentelemetry-ebpf-instrumentation#1069 で報告されているように、OEI v0.4.1 で修正された問題が原因
- 修正の PR は Fix verifier error on 6.18 open-telemetry/opentelemetry-ebpf-instrumentation#1071
- 現時点の Beyla v2.8.5 ではまだこの修正が入ってないからトレースが表示されない
- 現時点での対策は
grafana/beyla:3.1.0-rc0もしくはgrafana/beyla:3.0.0-rc5を使う- LTS Kernel (6.12) を使う
- わりとすぐに 3.0 が出そうな雰囲気があるので、それまで待つのも手。
以下の compose file を書いて計装を試したら、
services:
goblog:
image: mariomac/goblog:dev
ports:
- "18443:8443"
autoinstrumenter:
image: grafana/beyla:2.8.5
pid: "service:goblog"
privileged: true
environment:
BEYLA_TRACE_PRINTER: text
BEYLA_OPEN_PORT: 8443
自動計装した (instrumenting process) のログは出るけど、BEYLA_TRACE_PRINTER によるトレースログが何も出てこなかった。
❯❯ sudo docker compose up
Attaching to autoinstrumenter-1, goblog-1
goblog-1 | time=2026-02-17T14:13:42.369Z level=INFO msg="Starting GoBlog..."
goblog-1 | time=2026-02-17T14:13:42.369Z level=INFO msg="loading all blog entries and pages" dir=entries
goblog-1 | time=2026-02-17T14:13:42.370Z level=INFO msg="Scanning for template" folder=template
goblog-1 | time=2026-02-17T14:13:42.370Z level=INFO msg="start file changes notifier" folder=./
goblog-1 | time=2026-02-17T14:13:42.470Z level=INFO msg="Working with secure port" port=8443
goblog-1 | time=2026-02-17T14:13:42.470Z level=WARN msg="creating insecure local certificates for localhost development only"
goblog-1 | time=2026-02-17T14:13:42.470Z level=INFO msg="Redirecting insecure traffic" srcPort=8080 dstPort=8443
goblog-1 | time=2026-02-17T14:13:42.470Z level=INFO msg="reloading blog after grace period" folder=./ event="CREATE \"tmp/local_dev_certs123212959\"" gracePeriod=2s
autoinstrumenter-1 | time=2026-02-17T14:13:42.481Z level=INFO msg="Grafana Beyla" Version=v2.8.5 Revision=0e2c7bd "OpenTelemetry SDK Version"=1.39.0
autoinstrumenter-1 | time=2026-02-17T14:13:43.484Z level=INFO msg="starting Beyla in Application Observability mode"
autoinstrumenter-1 | time=2026-02-17T14:13:43.484Z level=INFO msg="using hostname" component=traces.ReadDecorator function=instance_ID_hostNamePIDDecorator hostname=7b2afa4b5c79
autoinstrumenter-1 | time=2026-02-17T14:13:43.485Z level=INFO msg="using hostname" component=traces.ReadDecorator function=instance_ID_hostNamePIDDecorator hostname=7b2afa4b5c79
autoinstrumenter-1 | time=2026-02-17T14:13:43.485Z level=INFO msg="Starting main node" component=beyla.Instrumenter
autoinstrumenter-1 | time=2026-02-17T14:13:43.608Z level=INFO msg="instrumenting process" component=discover.traceAttacher cmd=/goblog pid=1 ino=581696 type=go service=""
autoinstrumenter-1 | 2026-02-17 13:32:17.21713217 (0s[0s]) ProcessAlive(subType=0) 0 [ as :0]->[ as goblog:0] contentLen:0B responseLen:0B svc=[goblog go] traceparent=[]
goblog-1 | time=2026-02-17T14:13:44.470Z level=INFO msg="loading all blog entries and pages" dir=entries
goblog-1 | time=2026-02-17T14:13:44.472Z level=INFO msg="Scanning for template" folder=template
BEYLA_LOG_LEVEL: debug を足して詳細なログを出した。こんなエントリが表示されているので、discovery は nsPid=pid:[4026533178] として goblog を見つけている。
autoinstrumenter-1 | time=2026-02-17T14:43:05.241Z level=DEBUG msg="Found namespace" component=pids.Tracer nsPid=pid:[4026533178]
autoinstrumenter-1 | time=2026-02-17T14:43:05.241Z level=DEBUG msg="getting instrumentable information" component=discover.ExecTyper pid=1 comm=/goblog
autoinstrumenter-1 | time=2026-02-17T14:43:05.241Z level=DEBUG msg=inspecting component=discover.ExecTyper pid=1 comm=/goblog
そして、span として報告されてきたのが以下のエントリ
autoinstrumenter-1 | time=2026-02-17T14:44:29.488Z level=DEBUG msg="filtered spans from processes that did not match discovery" component=ebpfCommon.CommonPIDsFilter function=PIDsFilter.Filter inLen=1 outLen=0 pids="map[4026533178:map[1:{service:0xc000193000 pidType:2 otherKnownPids:[1]}]]" spans="[{Type:HTTP Flags:0 Method:GET Path:/ Route: Peer:172.19.0.1 PeerPort:59724 Host:172.19.0.2 HostPort:8443 Status:200 ResponseLength:0 ContentLength:0 RequestStart:4330923454385 Start:4330923509424 End:4330923887581 Service:{UID:{Name: Namespace: Instance:} SDKLanguage:unknown Metadata:map[] ProcPID:0 HostName: EnvVars:map[] flags:0 ExportModes:{blockSignal:0} Sampler:<nil> CustomInRouteMatcher:<nil> CustomOutRouteMatcher:<nil> HarvestedRouteMatcher:<nil> PathTrie:<nil>} TraceID:371ec9e7c463e4d358a136aecd86e9b6 SpanID:00473ebae0eecdcd ParentSpanID:0000000000000000 TraceFlags:1 Pid:{HostPID:46901 UserPID:1 Namespace:1} PeerName: HostName: OtherNamespace: Statement: SubType:0 DBError:{ErrorCode: Description:} DBNamespace: SQLCommand: SQLError:<nil> MessagingInfo:<nil> GraphQL:<nil> Elasticsearch:<nil> AWS:<nil> OverrideTraceName:}]"
pidmp は正しい
pids="map[4026533178:map[1:{service:0xc000193000 pidType:2 otherKnownPids:[1]}]]
ところが、pid の namespace が 1 になっている
Pid:{HostPID:46901 UserPID:1 Namespace:1}
つまり、以下だと Claude がいっていた
- eBPF が span の PID namespace として常に 1 を返していて、discovery が登録した実際の namespace ID と一致しないため、対象の span として扱われていない
- 原因として考えられるのは以下
- Kernal 6.18 で eBPF のバグ
- Kernal 6.18 で eBPF の挙動が変わった事に OBI が対応できていない
そこで、以下の両方を試してみると、どちらも span が表示されるようになった
- Kernel として
kernel-lts(6.12) を使う grafana/beyla:mainを使う
autoinstrumenter-1 | 2026-02-17 15:01:34.2173134 (210.309µs[198.759µs]) HTTP(subType=0) 200 GET /(/) [172.19.0.1 as 172.19.0.1:35520]->[172.19.0.2 as goblog:8443] contentLen:0B responseLen:0B svc=[goblog go] traceparent=[00-52c46a6cc303ec9570e3d659b6be62ac-8cd4bf568441fcf1[0000000000000000]-01]
autoinstrumenter-1 | 2026-02-17 15:04:47.2173447 (43.881µs[31.321µs]) HTTP(subType=0) 200 GET /(/) [172.19.0.1 as 172.19.0.1:59274]->[172.19.0.2 as goblog:8443] contentLen:0B responseLen:0B svc=[goblog go] traceparent=[00-ac0bfcf4c659ef03ad264624c0d07647-63a46c4b604ff4a0[0000000000000000]-01]
これは OBI のバグだなと思って、Issue を探すと opentelemetry-ebpf-instrumentation#1069 が見つかった。 そして、この問題は open-telemetry/opentelemetry-ebpf-instrumentation#1071 で修正されていた。
というわけでこんな問題だった模様:
- Kernel 6.18 で OBI が PID namespace を扱う所で eBPF の verifier エラーが起きるようになった。
- そこでクラッシュするわけではなく、この場合 PID namespace を 1 として報告していた
- その結果、トレースが全部フィルタで消えていた
その後 grafana/beyla:3.1.0-rc0 と grafana/beyla:3.0.0-rc5 も試したら、これらでも問題は解消していた。ので、次のリリースでは問題ないはず。
という顛末。おわり。