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
Expand Up @@ -132,7 +132,7 @@ test('Creates lifecycle spans for Elysia hooks', async ({ baseURL, request }) =>
expect(spans).toContainEqual(
expect.objectContaining({
description: 'Handle',
op: 'request_handler.elysia',
op: 'handler',
origin: 'auto.http.elysia',
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ test('Creates lifecycle spans for Elysia hooks', async ({ baseURL, request }) =>
expect(spans).toContainEqual(
expect.objectContaining({
description: 'Handle',
op: 'request_handler.elysia',
op: 'handler',
origin: 'auto.http.elysia',
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ test.describe('multi-fetch: internal .request() calls between sub-apps', () => {
});

test.describe('trace propagation through internal .request() calls', () => {
test('single internal fetch produces a hono.request child span', async ({ baseURL }) => {
test('single internal fetch produces an internal-request child span', async ({ baseURL }) => {
const transactionPromise = waitForTransaction(APP_NAME, event => {
return (
event.contexts?.trace?.op === 'http.server' && event.transaction === `GET ${STOREFRONT}/product/:productId`
Expand All @@ -198,20 +198,22 @@ test.describe('multi-fetch: internal .request() calls between sub-apps', () => {
const traceId = transaction.contexts?.trace?.trace_id;
const spans = transaction.spans || [];

const internalRequestSpans = spans.filter((s: { op?: string }) => s.op === 'hono.request');
const internalRequestSpans = spans.filter(
(s: { origin?: string }) => s.origin === 'auto.http.hono.internal_request',
);

expect(internalRequestSpans).toHaveLength(1);
expect(internalRequestSpans[0]).toEqual(
expect.objectContaining({
op: 'hono.request',
op: 'http.server',
origin: 'auto.http.hono.internal_request',
trace_id: traceId,
}),
);
expect(internalRequestSpans[0]?.description).toContain('GET /item/self-watering-plant');
});

test('parallel internal fetches produce two sibling hono.request spans', async ({ baseURL }) => {
test('parallel internal fetches produce two sibling internal-request spans', async ({ baseURL }) => {
const transactionPromise = waitForTransaction(APP_NAME, event => {
return (
event.contexts?.trace?.op === 'http.server' &&
Expand All @@ -225,7 +227,9 @@ test.describe('multi-fetch: internal .request() calls between sub-apps', () => {
const traceId = transaction.contexts?.trace?.trace_id;
const spans = transaction.spans || [];

const internalRequestSpans = spans.filter((s: { op?: string }) => s.op === 'hono.request');
const internalRequestSpans = spans.filter(
(s: { origin?: string }) => s.origin === 'auto.http.hono.internal_request',
);

expect(internalRequestSpans).toHaveLength(2);

Expand All @@ -238,7 +242,7 @@ test.describe('multi-fetch: internal .request() calls between sub-apps', () => {
expect(internalRequestSpans[1]?.origin).toBe('auto.http.hono.internal_request');
});

test('sequential chained fetches produce two ordered hono.request spans', async ({ baseURL }) => {
test('sequential chained fetches produce two ordered internal-request spans', async ({ baseURL }) => {
const transactionPromise = waitForTransaction(APP_NAME, event => {
return (
event.contexts?.trace?.op === 'http.server' &&
Expand All @@ -253,7 +257,7 @@ test.describe('multi-fetch: internal .request() calls between sub-apps', () => {
const spans = transaction.spans || [];

const internalRequestSpans = spans
.filter((s: { op?: string }) => s.op === 'hono.request')
.filter((s: { origin?: string }) => s.origin === 'auto.http.hono.internal_request')
.sort(
(a: { start_timestamp?: number }, b: { start_timestamp?: number }) =>
(a.start_timestamp ?? 0) - (b.start_timestamp ?? 0),
Expand All @@ -270,7 +274,7 @@ test.describe('multi-fetch: internal .request() calls between sub-apps', () => {
expect(internalRequestSpans[1]?.trace_id).toBe(traceId);
});

test('hono.request span has no error status for internal 4xx HTTPException', async ({ baseURL }) => {
test('internal-request span has no error status for internal 4xx HTTPException', async ({ baseURL }) => {
const transactionPromise = waitForTransaction(APP_NAME, event => {
return (
event.contexts?.trace?.op === 'http.server' &&
Expand All @@ -283,7 +287,9 @@ test.describe('multi-fetch: internal .request() calls between sub-apps', () => {
const transaction = await transactionPromise;
const spans = transaction.spans || [];

const internalRequestSpans = spans.filter((s: { op?: string }) => s.op === 'hono.request');
const internalRequestSpans = spans.filter(
(s: { origin?: string }) => s.origin === 'auto.http.hono.internal_request',
);

expect(internalRequestSpans).toHaveLength(1);
expect(internalRequestSpans[0]?.status).not.toBe('internal_error');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ test('Sends an API route transaction', async ({ baseURL }) => {
'express.type': 'request_handler',
'http.route': '/test-transaction',
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
},
op: 'request_handler.express',
op: 'handler',
description: '/test-transaction',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down Expand Up @@ -105,7 +105,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
data: {
'sentry.origin': 'auto.http.nestjs',
'sentry.op': 'handler.nestjs',
'sentry.op': 'handler',
component: '@nestjs/core',
'nestjs.version': expect.any(String),
'nestjs.type': 'handler',
Expand All @@ -117,7 +117,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
timestamp: expect.any(Number),
status: 'ok',
origin: 'auto.http.nestjs',
op: 'handler.nestjs',
op: 'handler',
},
]),
transaction: 'GET /test-transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ test('Sends an API route transaction', async ({ baseURL }) => {
'express.type': 'request_handler',
'http.route': '/test-transaction',
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
},
op: 'request_handler.express',
op: 'handler',
description: '/test-transaction',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down Expand Up @@ -109,7 +109,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
data: {
'sentry.origin': 'auto.http.nestjs',
'sentry.op': 'handler.nestjs',
'sentry.op': 'handler',
component: '@nestjs/core',
'nestjs.version': expect.any(String),
'nestjs.type': 'handler',
Expand All @@ -121,7 +121,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
timestamp: expect.any(Number),
status: 'ok',
origin: 'auto.http.nestjs',
op: 'handler.nestjs',
op: 'handler',
},
]),
transaction: 'GET /test-transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ test('Sends an API route transaction', async ({ baseURL }) => {
'express.type': 'request_handler',
'http.route': '/test-transaction',
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
},
op: 'request_handler.express',
op: 'handler',
description: '/test-transaction',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down Expand Up @@ -131,7 +131,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
data: {
'sentry.origin': 'auto.http.nestjs',
'sentry.op': 'handler.nestjs',
'sentry.op': 'handler',
component: '@nestjs/core',
'nestjs.version': expect.any(String),
'nestjs.type': 'handler',
Expand All @@ -143,7 +143,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
timestamp: expect.any(Number),
status: 'ok',
origin: 'auto.http.nestjs',
op: 'handler.nestjs',
op: 'handler',
},
]),
transaction: 'GET /test-transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ test.skip('Sends an API route transaction', async ({ baseURL }) => {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
data: {
'sentry.origin': 'auto.http.otel.fastify',
'sentry.op': 'request_handler.fastify',
'sentry.op': 'handler',
'hook.name': 'fastify -> @sentry/instrumentation-fastify -> @fastify/middie - route-handler',
'fastify.type': 'request-handler',
'http.route': '/test-transaction',
'hook.callback.name': 'anonymous',
},
description: '@fastify/middie - route-handler',
op: 'request_handler.fastify',
op: 'handler',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
Expand Down Expand Up @@ -125,7 +125,7 @@ test.skip('Sends an API route transaction', async ({ baseURL }) => {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
data: {
'sentry.origin': 'auto.http.nestjs',
'sentry.op': 'handler.nestjs',
'sentry.op': 'handler',
component: '@nestjs/core',
'nestjs.version': expect.any(String),
'nestjs.type': 'handler',
Expand All @@ -136,7 +136,7 @@ test.skip('Sends an API route transaction', async ({ baseURL }) => {
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
status: 'ok',
op: 'handler.nestjs',
op: 'handler',
origin: 'auto.http.nestjs',
},
{
Expand Down Expand Up @@ -799,7 +799,7 @@ test('Sets error status on nest spans when a handler throws', async ({ baseURL }
expect(transactionEvent.spans).toEqual(
expect.arrayContaining([
expect.objectContaining({ op: 'request_context.nestjs', status: 'internal_error' }),
expect.objectContaining({ op: 'handler.nestjs', status: 'internal_error' }),
expect.objectContaining({ op: 'handler', status: 'internal_error' }),
]),
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test('request_context + handler: a route transaction nests the nestjs spans', as

// request_handler span: wraps the controller method itself.
const handler = (transactionEvent.spans ?? []).find(
span => span.op === 'handler.nestjs' && span.description === 'testTransaction',
span => span.op === 'handler' && span.description === 'testTransaction',
);
expect(handler).toBeDefined();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ test('Sends an API route transaction from module', async ({ baseURL }) => {
'express.type': 'request_handler',
'http.route': '/example-module/transaction',
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
},
op: 'request_handler.express',
op: 'handler',
description: '/example-module/transaction',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down Expand Up @@ -105,7 +105,7 @@ test('Sends an API route transaction from module', async ({ baseURL }) => {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
data: {
'sentry.origin': 'auto.http.nestjs',
'sentry.op': 'handler.nestjs',
'sentry.op': 'handler',
component: '@nestjs/core',
'nestjs.version': expect.any(String),
'nestjs.type': 'handler',
Expand All @@ -117,7 +117,7 @@ test('Sends an API route transaction from module', async ({ baseURL }) => {
timestamp: expect.any(Number),
status: 'ok',
origin: 'auto.http.nestjs',
op: 'handler.nestjs',
op: 'handler',
},
]),
transaction: 'GET /example-module/transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ test('Sends an API route transaction from module', async ({ baseURL }) => {
'express.type': 'request_handler',
'http.route': '/example-module/transaction',
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
},
op: 'request_handler.express',
op: 'handler',
description: '/example-module/transaction',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down Expand Up @@ -105,7 +105,7 @@ test('Sends an API route transaction from module', async ({ baseURL }) => {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
data: {
'sentry.origin': 'auto.http.nestjs',
'sentry.op': 'handler.nestjs',
'sentry.op': 'handler',
component: '@nestjs/core',
'nestjs.version': expect.any(String),
'nestjs.type': 'handler',
Expand All @@ -117,7 +117,7 @@ test('Sends an API route transaction from module', async ({ baseURL }) => {
timestamp: expect.any(Number),
status: 'ok',
origin: 'auto.http.nestjs',
op: 'handler.nestjs',
op: 'handler',
},
]),
transaction: 'GET /example-module/transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ test('Should record a transaction for route with parameters', async ({ request }
'express.type': 'request_handler',
'http.route': '/test-transaction/:param',
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
},
op: 'request_handler.express',
op: 'handler',
description: '/test-transaction/:param',
origin: 'auto.http.express',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ test('Sends an API route transaction', async ({ baseURL }) => {
expect(spans).toContainEqual({
data: {
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
'http.route': '/test-transaction',
'express.name': '/test-transaction',
'express.type': 'request_handler',
},
description: '/test-transaction',
op: 'request_handler.express',
op: 'handler',
origin: 'auto.http.express',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ test('Sends an API route transaction', async ({ baseURL }) => {
expect(spans).toContainEqual({
data: {
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
'http.route': '/test-transaction',
'express.name': '/test-transaction',
'express.type': 'request_handler',
},
description: '/test-transaction',
op: 'request_handler.express',
op: 'handler',
origin: 'auto.http.express',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ test('Sends an API route transaction', async ({ baseURL }) => {
expect(spans).toContainEqual({
data: {
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
'http.route': '/test-transaction',
'express.name': '/test-transaction',
'express.type': 'request_handler',
},
description: '/test-transaction',
op: 'request_handler.express',
op: 'handler',
origin: 'auto.http.express',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ test('Sends an API route transaction', async ({ baseURL }) => {
expect(spans).toContainEqual({
data: {
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
'http.route': '/test-transaction',
'express.name': '/test-transaction',
'express.type': 'request_handler',
},
description: '/test-transaction',
op: 'request_handler.express',
op: 'handler',
origin: 'auto.http.express',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down Expand Up @@ -198,14 +198,14 @@ test('Sends an API route transaction for an errored route', async ({ baseURL })
expect(spans).toContainEqual({
data: {
'sentry.origin': 'auto.http.express',
'sentry.op': 'request_handler.express',
'sentry.op': 'handler',
'http.route': '/test-exception/:id',
'express.name': '/test-exception/:id',
'express.type': 'request_handler',
'error.type': 'Error',
},
description: '/test-exception/:id',
op: 'request_handler.express',
op: 'handler',
origin: 'auto.http.express',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down
Loading
Loading