Skip to content

containers: Add SpanContext to relevant container.capnp calls#6777

Open
gabivlj wants to merge 1 commit into
mainfrom
gv/traces
Open

containers: Add SpanContext to relevant container.capnp calls#6777
gabivlj wants to merge 1 commit into
mainfrom
gv/traces

Conversation

@gabivlj
Copy link
Copy Markdown
Contributor

@gabivlj gabivlj commented May 21, 2026

We need these so the container service can extend them and debug issues easier.
Mainly spots like:

  1. start()
  2. status()
  3. connect()
  4. exec()

@gabivlj gabivlj requested review from a team as code owners May 21, 2026 22:24
danlapid
danlapid previously approved these changes May 21, 2026
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 21, 2026

The MessageSize{4, 0} is just a hint. With the SpanContext struct added, the message will be slightly larger but Cap'n Proto auto-resizes. Not an issue.

Let me verify one more thing -- the start request also sets spanContext but does it correctly via req.initSpanContext() (not req.initStartParams().initSpanContext()). Let me check how start is declared:

Looking at the capnp schema:

start @1 StartParams -> ();

This means StartParams is used inline as the params. So req.initSpanContext() is correct because the request object IS the StartParams. Similarly for exec, the request has initParams() which returns ExecOptions, and spanContext is on ExecOptions, so params.initSpanContext() is correct.

For status, the params are inline ((spanContext :SpanContext)), so statusRequest.initSpanContext() is correct.

For connect, the params are inline ((down :ByteStream, spanContext :SpanContext)), so req.initSpanContext() is correct.

Everything checks out. This is a clean, additive change. The Cap'n Proto schema changes are wire-compatible (adding optional fields to structs and method params). The C++ code correctly uses KJ_IF_SOME to conditionally set the span context. The code is consistent across all four call sites.

LGTM

github run

@danlapid danlapid dismissed their stale review May 21, 2026 22:42

Dismissing until it works

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 21, 2026

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.62%. Comparing base (7a626b1) to head (52ab5e9).

Files with missing lines Patch % Lines
src/workerd/api/container.c++ 0.00% 9 Missing ⚠️
src/workerd/io/worker.c++ 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6777      +/-   ##
==========================================
- Coverage   66.62%   66.62%   -0.01%     
==========================================
  Files         402      402              
  Lines      115914   115927      +13     
  Branches    19425    19429       +4     
==========================================
+ Hits        77230    77231       +1     
- Misses      27094    27107      +13     
+ Partials    11590    11589       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants