mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
perf: reuse diagnostic bundle byte count (#20292)
Co-authored-by: Orca Worker <orca-worker@localhost>
This commit is contained in:
@@ -58,6 +58,25 @@ describe('bundle — submission ID', () => {
|
||||
})
|
||||
|
||||
describe('bundle — collection', () => {
|
||||
it.each([
|
||||
{ kind: 'empty', names: [] },
|
||||
{ kind: 'ASCII', names: ['plain'] },
|
||||
{ kind: 'Unicode', names: ['漢字🙂', '\ud800'] },
|
||||
{ kind: 'capped', names: Array.from({ length: 600 }, () => '漢字🙂'.repeat(1000)) }
|
||||
])('reports the exact UTF-8 payload size for $kind records', ({ names }) => {
|
||||
writeFileSync(traceFile, makeNDJSON(names.map((name) => makeSpan({ name }))))
|
||||
const bundle = collectBundle({
|
||||
traceFilePath: traceFile,
|
||||
maxFiles: 1,
|
||||
appVersion: '1',
|
||||
platform: 'win32',
|
||||
arch: 'x64',
|
||||
osRelease: 'test',
|
||||
orcaChannel: 'dev'
|
||||
})
|
||||
expect(bundle.bytes).toBe(Buffer.byteLength(bundle.payload))
|
||||
})
|
||||
|
||||
it('emits a header line with bundle_submission_id, app_version, platform', () => {
|
||||
writeFileSync(traceFile, makeNDJSON([makeSpan()]))
|
||||
const bundle = collectBundle({
|
||||
|
||||
@@ -167,7 +167,7 @@ export function collectBundle(opts: CollectBundleOptions): CollectedBundle {
|
||||
return {
|
||||
bundleSubmissionId,
|
||||
payload,
|
||||
bytes: Buffer.byteLength(payload),
|
||||
bytes: currentBytes,
|
||||
spanCount
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user