File
Blob: src/workerd/api/tests/sql-test-tail.js
| 1 | // Copyright (c) 2025 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | import * as assert from 'node:assert'; |
| 5 | |
| 6 | import { |
| 7 | invocationPromises, |
| 8 | spans, |
| 9 | testTailHandler, |
| 10 | } from 'test:instrumentation-tail'; |
| 11 | |
| 12 | export default testTailHandler; |
| 13 | |
| 14 | export const test = { |
| 15 | async test(ctrl, env, ctx) { |
| 16 | await Promise.allSettled(invocationPromises); |
| 17 | let received = spans.values(); |
| 18 | |
| 19 | const reduced = received.reduce((acc, curr) => { |
| 20 | if (!acc[curr.name]) acc[curr.name] = 0; |
| 21 | acc[curr.name]++; |
| 22 | return acc; |
| 23 | }, {}); |
| 24 | assert.deepStrictEqual(reduced, { |
| 25 | durable_object_storage_exec: 268, |
| 26 | durable_object_storage_ingest: 1030, |
| 27 | durable_object_storage_getDatabaseSize: 3, |
| 28 | durable_object_storage_put: 18, |
| 29 | durable_object_storage_get: 18, |
| 30 | durable_object_storage_transaction: 8, |
| 31 | durable_object_subrequest: 47, |
| 32 | durable_object_storage_deleteAll: 1, |
| 33 | createStringTable: 4, |
| 34 | runActorFunc: 4, |
| 35 | durable_object_storage_sync: 4, |
| 36 | getStringTableIds: 4, |
| 37 | testMultiStatement: 1, |
| 38 | testRollbackKvInit: 1, |
| 39 | testRollbackAlarmInit: 1, |
| 40 | durable_object_storage_setAlarm: 2, |
| 41 | durable_object_storage_getAlarm: 1, |
| 42 | testSessionsAPIBookmark: 20, |
| 43 | durable_object_storage_getCurrentBookmark: 20, |
| 44 | durable_object_storage_waitForBookmark: 19, |
| 45 | }); |
| 46 | }, |
| 47 | }; |