Skip to content

Fix distributed trace and HTTP log correlation - #408

Merged
mintuhouse merged 2 commits into
mainfrom
mintuhouse/stitch-http-traces
Oct 29, 2026
Merged

mintuhouse merged 2 commits into
mainfrom
mintuhouse/stitch-http-traces

Conversation

@mintuhouse

@mintuhouse mintuhouse commented Oct 29, 2026 •

Copy link
Copy Markdown
Member
  • Correlate Nitro HTTP requests, TanStack Start handlers, Effect operations, AI model/server-tool spans, and shipped logs so operators can identify the cause of slow or failed requests and chats.
  • Reuse OpenTelemetry's native async context manager and W3C propagator, Effect's parent-span helpers, and TanStack's existing AI middleware. Share scoped context management across Nitro/SSR module copies and avoid duplicate HTTP server spans.
  • Prevent captured handler-initialization spans from becoming parents of later requests, and preserve request context when the legacy /api/chat alias rewrites its URL.
  • Add matched route templates, standard HTTP metadata, request IDs, status/error types, and saved conversation/agent IDs through TanStack's built-in enrichment hook. Keep content capture disabled and existing credential redaction and network safeguards active.
  • Continue incoming W3C traces and propagate context to configured model and MCP services. Allow tracing headers through API CORS. Downstream services must accept and export that context to contribute spans.
  • End the HTTP span when the response is ready, while streamed model/tool work can finish later in the same trace.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T04:39:15.617632Z 5202bd7 New commits
🔒 Security Review ✅ Completed 2026-10-29T04:33:34.292322Z 360f59e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

mintuhouse commented Oct 29, 2026 •

Copy link
Copy Markdown
Member Author

Validation results for 5202bd70391727ec33396021d3399d34ac4d0691

  • Platform ready passed on the first commit: 552 tests passed, 140 skipped, plus formatting, OpenAPI freshness, lint/type checks, Knip, and production build.
  • After the annotation follow-up: platform check, production build, and 77 focused existing tests passed.
  • All GitHub Actions check jobs passed on the current head, including platform unit and integration tests, build, static checks, SDK, CLI, examples, and website.
  • Native compiled binary smoke: passed against a fresh disposable local database on the current head. The earlier shared-test-database run hit a shutdown timeout.
  • Local OTLP probe: verified incoming trace IDs through HTTP and Effect child spans, with matching shipped HTTP log span IDs. Confirmed HTTP scheme, server address/port, status, and 5xx error type. This probe exercises setup/error responses on a disposable deployment.
  • Platform browser suite: 15 passed in 3.5 minutes on the current head.
  • Todos deterministic browser suite: 66 passed in 2.0 minutes on the current head.
  • Automated code review completed with no findings on the current head. Final local review covered context ownership/cleanup, startup-span leakage, request aliases, header propagation, credential redaction, and scope.
  • Live PostHog: model generations and a nested read_attachment server-tool span verified before this patch. Production stitching, downstream-service ingestion, and the new annotations await deployment and a live recheck.

No observability tests or documentation changes were added. Browser reports are local at platform/e2e/.output/report/index.html and examples/todos/e2e/.output/report/index.html.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
website-astralbeam-ai 5202bd7 Commit Preview URL

Branch Preview URL
Oct 29 2026, 04:38 AM

@mintuhouse

Copy link
Copy Markdown
Member Author

@cursor review

@mintuhouse
mintuhouse merged commit 5c3e2ae into main Oct 29, 2026
12 checks passed
@mintuhouse
mintuhouse deleted the mintuhouse/stitch-http-traces branch October 29, 2026 04:49

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5202bd7. Configure here.

init?: RequestInit,
): Promise<Response> {
return fetch(input, traceRequestInit(input, init))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outbound traces miss captured parent

Medium Severity

traceRequestInit and TanStack otelMiddleware parent new work from context.active(), while this change already treats that OpenTelemetry context as lost after Effect resumes. Model, MCP, and AI spans can stay detached from the Nitro request trace, and outbound traceparent can be omitted or bound to the wrong span.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5202bd7. Configure here.

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