Skip to content

Pass tracing context from containerd-shim to runc and OCI hooks #12300

Closed

Description

@rutigs

What is the problem you're trying to solve

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.

[1] https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/0258-env-context-baggage-carriers.md

Additional context

No response

Activity

  1. rutigs commented on Sep 13, 2025

    @rutigs
    Author

    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!

  2. mikebrow commented on Sep 16, 2025

    @mikebrow
    Member
  3. fuweid commented on Sep 17, 2025

    @fuweid
    Member

    Thanks!

    cc @Cindia-blue here as there is enhancement for tracking CRI requests.

  4. rutigs commented on Sep 17, 2025

    @rutigs
    Author

    Ive got a small patch I can create a PR for but wasn't sure if our approach was in line with the maintainers

  5. Cindia-blue commented on Sep 17, 2025

    @Cindia-blue
    Contributor

    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.

  6. dosubot commented on Jul 30, 2026

    @dosubot

    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.

    Thanks for your understanding and contribution.

  7. github-actions commented on Aug 14, 2026

    @github-actions

    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.

  8. added
    status/roadmapped
    on Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalearea/runtimekind/featurestatus/roadmapped

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions