The best way to control Claude Code, Codex and more from any computer or phone
perf(server): stop tracing each transcript file in usage scans (#31586)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 6, 2026 at 11:55 UTC
8ee2f35eeb2d2a4b9603b5a1e0b7328289c97ac8
1 file changed
+7
-2
apps/server/src/usage/UsageService.ts
+7
-2
@@ -439,9 +439,10 @@ export const make = Effect.gen(function* () {
439
/**
440
* Reads run concurrently, and the caller stores updates in walk order rather
441
* than completion order: saved records of deleted transcripts aggregate in
442
- * cache order, where the first copy of a duplicate wins.
442
+ * cache order, where the first copy of a duplicate wins. Untraced: a scan
443
+ * reads thousands of files, so scanTranscriptDir records the counts instead.
444
*/
444
- const readFileRecords = Effect.fn("UsageService.readFileRecords")(function* (
445
+ const readFileRecords = Effect.fnUntraced(function* (
446
filePath: string,
447
size: number,
448
mtimeMs: number,
@@ -597,6 +598,10 @@ export const make = Effect.gen(function* () {
598
return { path, records, malformedRecords };
599
});
600
const unread = failedPaths + read.filter((file) => file.failed).length;
601
+ yield* Effect.annotateCurrentSpan({
602
+ "usage.files": files.length,
603
+ "usage.files_parsed": read.filter((file) => file.update !== undefined).length,
604
+ });
605
return {
606
provider,
607
dir,