Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): traces keep ~40% more history and no longer block the event loop #19430

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/19430/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 11 changed files with 125 additions and 30 deletions (loading 8).

x
0 of 11 viewed, 11 left
6 additions and 1 deletionapps/server/src/orchestration-v2/EventSink.tsModified
View file
@@ -399,7 +399,12 @@
yield* applyStoredEvents(committed);
yield* effectOutbox.enqueue(input.effects);
return committed;
- }),
+ }).pipe(
+ // Every streamed agent event is a write, so its statements would
+ // dominate the trace file. This span and its sql.transaction span
+ // still time each write, including the commit.
+ Effect.withTracerEnabled(false),
+ ),
(storedEvents) =>
Effect.gen(function* () {
if (input.effects.length > 0) {
26 additions and 0 deletionsapps/server/src/orchestration-v2/FoundationPersistence.test.tsModified
View file
@@ -447,6 +447,32 @@
​
+ it.effect("traces an event write and its transaction without its SQL statements", () =>
+ Effect.gen(function* () {
+ const sink = yield* EventSink.EventSinkV2;
+ const now = yield* DateTime.now;
+ const thread = makeThread(ThreadId.make("thread:untraced-write-statements"), now);
+ const names: Array<string> = [];
+ const tracer = Tracer.make({
+ span: (options) => {