Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(observability): stop writing empty spans on spawns, projected events, and idle polls #13756

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/13756/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 7 changed files with 89 additions and 8 deletions (loading 4).

x
0 of 7 viewed, 7 left
61 additions and 0 deletionsapps/server/src/orchestration/Layers/ProjectionPipeline.test.tsModified
View file
@@ -21,6 +21,7 @@
import * as Layer from "effect/Layer";
import * as Path from "effect/Path";
import * as Schema from "effect/Schema";
+import * as Tracer from "effect/Tracer";
import * as SqlClient from "effect/unstable/sql/SqlClient";
​
import { makeSqlStatementCounter } from "../../../integration/SqlStatementCounter.integration.ts";
@@ -114,6 +115,66 @@
​
+it.layer(Layer.fresh(makeProjectionPipelinePrefixedTestLayer("t3-projection-cleanup-span-")))(
+ "OrchestrationProjectionPipeline attachment cleanup span",
+ (it) => {
+ it.effect("runs attachment cleanup only for events that remove attachments", () =>
+ Effect.gen(function* () {
+ const projectionPipeline = yield* OrchestrationProjectionPipeline;
+ const eventStore = yield* OrchestrationEventStore;
+ let cleanupSpans = 0;
+ const tracer = Tracer.make({
+ span: (options) => {
+ if (options.name === "applyAttachmentSideEffects") cleanupSpans += 1;
+ return new Tracer.NativeSpan(options);
+ },
+ });
+ const now = "2026-01-01T00:00:00.000Z";
+ const projectId = ProjectId.make("project-cleanup-span");
+ const threadId = ThreadId.make("thread-cleanup-span");