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,7 +1,7 @@
import path from 'node:path';
import fs from 'node:fs';
import { pipeline } from 'node:stream/promises';
import { task } from './trace';
import { SpanCategory, task } from './trace';
import { extract as tarExtract } from 'tar-fs';
import type { Headers as TarEntryHeaders } from 'tar-fs';
import zlib from 'node:zlib';
@@ -34,9 +34,10 @@ export const downloadPreviousBuild = task(require.main === module, __filename)(a
return GITLAB_CODELOAD_URL;
}
return GITHUB_CODELOAD_URL;
});
}, SpanCategory.Network);
return span.traceChildAsync('download & extract previoud build', async () => {
// streaming download -> gunzip -> untar to disk, network dominates so that is the tag
return span.traceChildAsync('download & extract previous build', async () => {
const respBody = undici.pipeline(
tarGzUrl,
{
@@ -89,5 +90,5 @@ export const downloadPreviousBuild = task(require.main === module, __filename)(a
}
)
);
});
}, SpanCategory.Network);
});