GeezerVison is showing github.com — fix(observability): avoid spans for domain loops and row helpers · pingdotgg/t3code@5461b47
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/device/LocalDeviceHost.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -457,8 +457,9 @@ export const make = Effect.fn("LocalDeviceHost.make")(function* () { |
457 | 457 | Effect.ignoreCause, |
458 | 458 | ); |
459 | 459 |
|
| 460 | + // Waits for the hub's lifetime and re-forks on restart; a span would nest across restarts. |
460 | 461 | const superviseHub: (hub: HubProcess, hubTool: DeviceToolPaths) => Effect.Effect<void> = |
461 | | - Effect.fn("LocalDeviceHost.superviseHub")( |
| 462 | + Effect.fnUntraced( |
462 | 463 | function* (hub: HubProcess, hubTool: DeviceToolPaths) { |
463 | 464 | yield* Effect.result(hub.child.exitCode); |
464 | 465 | const running = yield* Ref.get(runningRef); |
|
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/relay/AgentAwarenessRelay.ts +5-4Lines changed: 5 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -728,10 +728,11 @@ export const make = Effect.gen(function* () { |
728 | 728 |
|
729 | 729 | // Many environments never link, so while unlinked the retry backs off from 5 |
730 | 730 | // s to 60 s. A linked environment keeps the 5 s retry, because `t3 connect |
731 | | - // publish` can turn publishing on from another process. |
732 | | - const publishActiveThreadsOnceWhenConfigured = Effect.fn( |
733 | | - "AgentAwarenessRelay.publishActiveThreadsOnceWhenConfigured", |
734 | | - )(function* (logEnabledWhenReady: boolean) { |
| 731 | + // publish` can turn publishing on from another process. Keep this untraced: |
| 732 | + // an unlinked environment can retry for the lifetime of the process. |
| 733 | + const publishActiveThreadsOnceWhenConfigured = Effect.fnUntraced(function* ( |
| 734 | + logEnabledWhenReady: boolean, |
| 735 | + ) { |
735 | 736 | let unlinkedRetryDelayMs = 5_000; |
736 | 737 | while (!(yield* Ref.get(activeSnapshotPublishedRef))) { |
737 | 738 | const result = yield* publishActiveThreadsUnsafe.pipe( |
|
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/scheduledTasks/ScheduledTaskService.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -281,7 +281,8 @@ function webhookEndpoint( |
281 | 281 | }; |
282 | 282 | } |
283 | 283 |
|
284 | | -const decodeRow = Effect.fn("ScheduledTaskService.decodeRow")( |
| 284 | +// Runs per task row; list and lookup operations already own the span. |
| 285 | +const decodeRow = Effect.fnUntraced( |
285 | 286 | function* (row: ScheduledTaskRow, origin: WebhookOrigin | null = null) { |
286 | 287 | const schedule = yield* decodeScheduleJson(row.schedule_json); |
287 | 288 | const webhook = schedule.type === "webhook" ? webhookEndpoint(row, origin) : undefined; |
|
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/telemetry/DelegatedTaskAnalytics.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,8 @@ const make = Effect.gen(function* () { |
40 | 40 | // A task can be re-reported with the same final status; count it once per process. |
41 | 41 | const reported = new Set<string>(); |
42 | 42 |
|
43 | | - const onSubagent = Effect.fn("DelegatedTaskAnalytics.onSubagent")( |
| 43 | + // Runs for every subagent update; most return early, so avoid a span per event. |
| 44 | + const onSubagent = Effect.fnUntraced( |
44 | 45 | function* (event: SubagentEvent) { |
45 | 46 | const task = event.payload; |
46 | 47 | if (task.origin !== "app_owned" || !FINAL_STATUSES.has(task.status)) return; |
|