Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { afterAll, expect } from 'vitest';
import { conditionalTest } from '../../../utils';
import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner';

describeWithDockerCompose('tedious auto instrumentation', { workingDirectory: [__dirname] }, () => {
Expand Down Expand Up @@ -92,6 +93,46 @@ describeWithDockerCompose('tedious auto instrumentation', { workingDirectory: [_
});
});

// tedious 20 requires Node >= 22.
conditionalTest({ min: 22 })('tedious v20', () => {
createEsmAndCjsTests(
__dirname,
'scenario.mjs',
'instrument-span-streaming.mjs',
(createTestRunner, test) => {
test('should auto-instrument `tedious` package', async () => {
await createTestRunner()
.expect({
span: container => {
const dbSpans = container.items.filter(item => item.attributes['sentry.origin']?.value === ORIGIN);

expect(dbSpans.map(span => span.name)).toEqual(
expect.arrayContaining([
'SELECT',
'callProcedure [dbo].[test_proced]',
'INSERT [dbo].[test_prepared]',
'execBulkLoad test_bulk',
'SELECT [dbo].[test_bulk]',
]),
);
expect(dbSpans.find(span => span.name === 'select')?.status).toBe('error');
expect(dbSpans[0]?.attributes).toMatchObject({
'db.system.name': { value: 'mssql' },
'db.namespace': { value: 'master' },
'db.user': { value: 'sa' },
'server.address': { value: '127.0.0.1' },
'server.port': { value: 1433 },
});
},
})
.start()
.completed();
});
},
{ additionalDependencies: { tedious: '^20' } },
);
});

createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument-span-streaming.mjs', (createTestRunner, test) => {
test('should name spans after the query summary with span streaming', async () => {
await createTestRunner()
Expand Down
2 changes: 1 addition & 1 deletion packages/server-utils/src/orchestrion/config/tedious.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const MODULE_NAME = 'tedious';
// OTel `supportedVersions`). Orchestrion never matches a file that doesn't exist, so a single entry is
// safe even for versions that shipped extra layouts.
const FILE_PATH = 'lib/connection.js';
const VERSION_RANGE = '>=1.11.0 <20';
const VERSION_RANGE = '>=1.11.0 <21';

// `Connection` methods that dispatch a request (each traced as one db span) plus `connect`, which the
// subscriber wraps for bookkeeping only (tracking the connection's active database, read into `db.name`).
Expand Down
Loading