Skip to content

feat: auto-inject W3C traceparent on every request#77

Open
gurdasnijor wants to merge 1 commit intomainfrom
feat/auto-traceparent
Open

feat: auto-inject W3C traceparent on every request#77
gurdasnijor wants to merge 1 commit intomainfrom
feat/auto-traceparent

Conversation

@gurdasnijor
Copy link

@gurdasnijor gurdasnijor commented Feb 24, 2026

Summary

  • Adds automatic traceparent header injection in prepareRequest() — every SDK request gets a unique W3C Trace Context header
  • Downstream CF workers honor the incoming trace_id, producing end-to-end distributed traces from SDK → API → gateway → upstream
  • Zero new dependencies — uses the existing uuid4() utility already in the SDK

How it works

SDK request (traceparent: 00-{traceId}-{spanId}-01)
  → CF Worker picks up traceparent
    → Uses traceId for its own spans
      → Full trace tree visible in BetterStack

Verified

Tested against staging — trace IDs from SDK requests appear in BetterStack with matching fetchHandler, drizzle.select, and Cache spans.

Note

Keep this PR open until the observability branch lands in prod on the monorepo side.

Adds automatic distributed tracing propagation to every SDK request.
Each outbound fetch gets a unique traceparent header (W3C Trace Context
format) so downstream Smithery services can correlate requests into
end-to-end traces.

Zero dependencies — uses the existing uuid4() utility already in the SDK.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant