Skip to content

Commit 5f9fcff

Browse files
onlydoleclaude
andcommitted
perf(server): stop tracing per-event live coalescer work
cancelWindow, flushPending and offerAll run for every live thread event or batch and finish in under a millisecond. Their spans took 8% of a local trace window and pushed history out of the rotating trace file. They are now Effect.fnUntraced; the per-subscription construction span stays. Refs #28196 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5b9731c commit 5f9fcff

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎apps/server/src/orchestration-v2/ThreadLiveEventCoalescer.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ export const makeThreadLiveEventCoalescer = Effect.fn(
9595
let windowFiber: Fiber.Fiber<void, never> | null = null;
9696
let closed = false;
9797

98-
const cancelWindow = Effect.fn("ThreadLiveEventCoalescer.cancelWindow")(function* () {
98+
// cancelWindow/flushPending/offerAll run per live event or batch; sub-ms spans here would flood the rotating trace.
99+
const cancelWindow = Effect.fnUntraced(function* () {
99100
const fiber = windowFiber;
100101
if (!fiber) {
101102
return;
@@ -104,7 +105,7 @@ export const makeThreadLiveEventCoalescer = Effect.fn(
104105
yield* Fiber.interrupt(fiber);
105106
});
106107

107-
const flushPending = Effect.fn("ThreadLiveEventCoalescer.flushPending")(function* () {
108+
const flushPending = Effect.fnUntraced(function* () {
108109
if (pendingUpdates.length === 0) {
109110
return;
110111
}
@@ -135,9 +136,7 @@ export const makeThreadLiveEventCoalescer = Effect.fn(
135136

136137
// Keep each source batch together so a synchronization marker cannot pass
137138
// events already pulled from PubSub but still being coalesced.
138-
const offerAll = Effect.fn("ThreadLiveEventCoalescer.offerAll")(function* (
139-
inputs: ReadonlyArray<ThreadLiveInput>,
140-
) {
139+
const offerAll = Effect.fnUntraced(function* (inputs: ReadonlyArray<ThreadLiveInput>) {
141140
yield* mutex.withPermits(1)(
142141
Effect.forEach(
143142
inputs,

0 commit comments

Comments
 (0)