You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pass tracing context from containerd-shim to runc and OCI hooks #12300
Open telemetry tracing when fully instrumented starts in the pod lifecycle within kubelet and goes all the way through containerd, and optionally into the containerd-shim-runc-v2 if you enable the shim_tracing build tag.
As our runc and OCI hooks also support tracing, it would be nice to complete the connection by passing the tracing parameters one more level down.
Describe the solution you'd like
While containerd passes the tracing context via ttrpc to the shim, this is not possible for runc and subsequent OCI hooks are binary invoked (and with code not in this project). To pass to those processes we can utilize the environment specification [1] as those binaries inherit the environment and can choose whether to create new sub spans or not.
At Netflix we've implemented this as a small ttrpc interceptor in the service in cmd/containerd-shim-runc-v2/task/ which updates the environment on each rpc into the shim to propagate the trace context for that call into runc and our OCI hooks. This works and we're happy to share/upstream this but we were wondering if there's a better solution before doing so. Happy to discuss!
I wanted to highlight that the framework Wei and I have been working on is designed to enable extensible container runtime tracing — including what’s described here such as RunC, image, snapshotter, and CNI instrumentation.
In fact, once our current work is landed, RunC-level tracing and other internal subsystem spans can be enabled with minimal effort — the hooks and attribute structures are already built with that in mind.
So it’s great to see strong alignment here. Happy to help ensure the design reflects what’s already available (or soon to be), and to collaborate further on evolving this tracing capability across subsystems.
Hi, @rutigs. I'm Dosu, and I'm helping the containerd team manage their backlog and am marking this issue as stale.
Issue Summary
You opened this issue to propagate OpenTelemetry trace context from containerd-shim-runc-v2 into runc and OCI hooks so tracing can continue beyond the shim.
The proposed implementation was to pass tracing data through environment variables inherited by spawned processes.
You later shared that Netflix already has a working ttrpc interceptor in cmd/containerd-shim-runc-v2/task/ that updates the environment on each RPC into the shim, and offered to upstream it if it aligns with maintainers’ direction.
Maintainers responded positively, with related tracing and CRI request-tracking work being referenced, and the thread suggests general agreement on the need for this capability.
The remaining question appears to be how best to integrate this with the broader tracing framework already in progress.
Next Steps
Please let us know if this is still relevant to the latest version of containerd; if so, you can keep the discussion open by commenting here.
Otherwise, this issue will be automatically closed in 7 days.
This issue was closed because it has been stale for 2 weeks with no activity. Feel free to reopen or create a new issue if you would like to continue working on it.
Activity
rutigs commentedon Sep 13, 2025
At Netflix we've implemented this as a small ttrpc interceptor in the service in
cmd/containerd-shim-runc-v2/task/which updates the environment on each rpc into the shim to propagate the trace context for that call intoruncand our OCI hooks. This works and we're happy to share/upstream this but we were wondering if there's a better solution before doing so. Happy to discuss!mikebrow commentedon Sep 16, 2025
thanks! @fuweid @samuelkarp @chrishenzie @klihub
fuweid commentedon Sep 17, 2025
Thanks!
cc @Cindia-blue here as there is enhancement for tracking CRI requests.
rutigs commentedon Sep 17, 2025
Ive got a small patch I can create a PR for but wasn't sure if our approach was in line with the maintainers
Cindia-blue commentedon Sep 17, 2025
Thanks for sharing this proposal!
I wanted to highlight that the framework Wei and I have been working on is designed to enable extensible container runtime tracing — including what’s described here such as RunC, image, snapshotter, and CNI instrumentation.
In fact, once our current work is landed, RunC-level tracing and other internal subsystem spans can be enabled with minimal effort — the hooks and attribute structures are already built with that in mind.
So it’s great to see strong alignment here. Happy to help ensure the design reflects what’s already available (or soon to be), and to collaborate further on evolving this tracing capability across subsystems.
dosubot commentedon Jul 30, 2026
Hi, @rutigs. I'm Dosu, and I'm helping the containerd team manage their backlog and am marking this issue as stale.
Issue Summary
containerd-shim-runc-v2intoruncand OCI hooks so tracing can continue beyond the shim.cmd/containerd-shim-runc-v2/task/that updates the environment on each RPC into the shim, and offered to upstream it if it aligns with maintainers’ direction.Next Steps
Thanks for your understanding and contribution.
github-actions commentedon Aug 14, 2026
This issue was closed because it has been stale for 2 weeks with no activity. Feel free to reopen or create a new issue if you would like to continue working on it.
Add WithExtraEnv to set the environment per invocation
Add WithExtraEnv to set the environment per invocation