fix(cli): isolate server request traces (#37395)

This commit is contained in:
Dustin Deus
2026-07-17 00:52:14 +02:00
committed by GitHub
parent 309860558d
commit 331533deff
5 changed files with 65 additions and 6 deletions
+5 -1
View File
@@ -10,6 +10,7 @@ import { HttpMiddleware, HttpRouter, HttpServer, HttpServerRequest, HttpServerRe
import { createServer } from "node:http"
import { ServerAuth } from "./auth"
import { authorizedRequest } from "./middleware/authorization"
import { withoutParentSpan } from "./request-tracing"
import { createRoutes } from "./routes"
import { ServerInfo } from "./server-info"
import { Status } from "./service-status"
@@ -39,7 +40,10 @@ export const start = Effect.fn("ServerProcess.start")(function* <E, R>(options:
})
const bound = yield* listen(options)
const application = yield* Ref.make(Option.none<App>())
yield* bound.http.serve(dispatch(options.password, status, application, shutdown), HttpMiddleware.logger)
// Request fibers may continue inbound trace context, but must not inherit the server startup parent.
yield* bound.http
.serve(dispatch(options.password, status, application, shutdown), HttpMiddleware.logger)
.pipe(withoutParentSpan)
if (options.service) yield* options.service.onListen(bound.http.address)
const parentScope = yield* Scope.Scope
+6
View File
@@ -0,0 +1,6 @@
import { Context, Effect, Scope, Tracer } from "effect"
export const withoutParentSpan = <A, E>(effect: Effect.Effect<A, E, Scope.Scope>) =>
effect.pipe(
Effect.updateContext((context: Context.Context<Scope.Scope>) => Context.omit(Tracer.ParentSpan)(context)),
)