Chore: better stat tracking

This commit is contained in:
SukkaW
2026-09-02 15:23:12 +08:00
parent 3c5c5ac4bd
commit 3e03018bbe
28 changed files with 933 additions and 187 deletions

View File

@@ -1,4 +1,4 @@
import { task } from './trace';
import { SpanCategory, task } from './trace';
import path from 'node:path';
import fs from 'node:fs';
import { pipeline } from 'node:stream/promises';
@@ -22,7 +22,9 @@ export const downloadMockAssets = task(require.main === module, __filename)(asyn
return Promise.all(Object.entries(ASSETS_LIST).map(
([filename, url]) => span
.traceChildAsync(url, async () => {
// fetch + stream straight to disk; the transfer dominates
.traceChild(url, SpanCategory.Network)
.traceAsyncFn(async () => {
const res = await $$fetch(url);
if (!res.ok) {
console.error(`Failed to download ${url}`);