Skip to main content

instrumentDispatcher

@forge/monorepo


@forge/monorepo / backend/src / instrumentDispatcher

Function: instrumentDispatcher()

instrumentDispatcher(inner, deps): JobDispatcher

Defined in: backend/src/telemetry/instrument.ts:56

Wrap a dispatcher so the enqueue is a span and the job carries the trace forward.

The traceparent goes down through enqueueRun, which #143 widened to accept it. The first version of this remembered the span it had just opened and let the adapter read it back — which is wrong the moment two enqueues overlap, and overlapping enqueues are the normal case, not the edge one. A racy trace link is worse than none: it attributes one tenant's run to another tenant's request.

Parameters

inner

JobDispatcher

deps

InstrumentedDispatcherDeps

Returns

JobDispatcher