One http.server span per request: the worker defers to Effect's tracer#985
Merged
Conversation
Every API/MCP request produced TWO identical sibling http.server spans: the worker-boundary span server.ts opens (scope executor-cloud-worker) AND the one Effect's HttpMiddleware.tracer opens for app-owned paths (scope executor-cloud) — both joined the caller's traceparent, so the waterfall showed a childless twin next to the real envelope, and server span ingest was doubled (visible in Axiom: 39.7k executor-cloud vs 24.9k executor-cloud-worker spans on /mcp alone). The worker now skips its span for app-owned paths (app-paths.ts: /api/*, /mcp, /.well-known/*) — Effect's middleware already parses traceparent and parents the workos/store/db children there. Non-app paths (Start SSR, marketing proxy, /_astro assets) keep the worker envelope span, and the flush-on-waitUntil still runs on both branches so batched exports survive the isolate. Verified against the suite motel: API scenario + browser scenario runs now record exactly one http.server per trace (worker scope only on / and SSR routes), browser→server join intact (executor-web client span → executor-cloud server span → workos/user_store/fumadb children); cloud observability unit tests green. Found via the prod Axiom dataset right after #981 made browser traces land — the duplicate was previously invisible without the join.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | 60a39bf | Jun 12 2026, 06:33 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | 60a39bf | Commit Preview URL Branch Preview URL |
Jun 12 2026, 06:32 PM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Every API/MCP request produced two identical sibling
http.serverspans: the worker-boundary spanserver.tsopens (scopeexecutor-cloud-worker) and the one Effect'sHttpMiddleware.traceropens for app-owned paths (scopeexecutor-cloud). Both join the caller'straceparent, so they land in the same trace as twins — the waterfall shows a childless duplicate next to the real envelope (all the workos/store/db children parent under Effect's span), and server-span ingest is doubled. In the production dataset that's ~25k duplicate spans against ~40k real ones on/mcpalone.The duplicate was invisible until the browser span export landed (#981) and made joined traces inspectable end to end — the first real waterfall showed the twin immediately.
The fix
The worker now skips its envelope span for app-owned paths (
app-paths.ts:/api/*,/mcp,/.well-known/*) — Effect's middleware already parsestraceparentitself and parents the child spans there. Non-app paths (Start SSR, the marketing proxy,/_astroassets — which Effect never sees) keep the worker span, and the flush-on-waitUntilruns on both branches so batched exports survive the isolate.After deploy,
executor-cloud-worker-scope server spans become a meaningful signal ("non-app traffic") instead of noise.Verified
Against the suite-owned motel trace store (#979): API + browser scenario runs record exactly one
http.serverspan per trace (worker scope appears only on/and SSR routes), and the browser→server join is intact —executor-webclient span →executor-cloudserver span →workos/user_store/fumadbchildren. Cloud observability unit tests 10/10; lint/format/typecheck clean.