Skip to content
Closed
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
Expand Up @@ -53,22 +53,22 @@ test.describe('orchestrion DB instrumentation', () => {

// With span streaming the span name is the low-cardinality query summary; the statement
// stays in `db.query.text`.
for (const query of ['SELECT 1 + 1 AS solution', 'SELECT NOW()']) {
expect(mysqlSpans).toContainEqual(
expect.objectContaining({
name: 'SELECT',
status: 'ok',
attributes: expect.objectContaining({
'sentry.origin': { value: 'auto.db.mysql', type: 'string' },
'db.system.name': { value: 'mysql', type: 'string' },
'db.query.text': { value: query, type: 'string' },
'db.user': { value: 'root', type: 'string' },
'db.connection_string': { value: expect.any(String), type: 'string' },
'server.address': { value: expect.any(String), type: 'string' },
'server.port': { value: 3306, type: 'integer' },
}),
const expectedQuerySpan = (query: string) =>
expect.objectContaining({
name: 'SELECT',
status: 'ok',
attributes: expect.objectContaining({
'sentry.origin': { value: 'auto.db.mysql', type: 'string' },
'db.system.name': { value: 'mysql', type: 'string' },
'db.query.text': { value: query, type: 'string' },
'db.user': { value: 'root', type: 'string' },
'db.connection_string': { value: expect.any(String), type: 'string' },
'server.address': { value: expect.any(String), type: 'string' },
'server.port': { value: 3306, type: 'integer' },
}),
);
}
});

expect(mysqlSpans).toContainEqual(expectedQuerySpan('SELECT 1 + 1 AS solution'));
expect(mysqlSpans).toContainEqual(expectedQuerySpan('SELECT NOW()'));
});
});
Loading