Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small info when reviewing this: All the files have exactly the same changes :)

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
return txnEvent.transaction.includes('GET /test-param/');
});

const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
page.goto(`/test-param/${PARAM}`),
const res = await page.goto(`/test-param/${PARAM}`);
const data = await res.json();

const [clientTxnEvent, serverTxnEvent] = await Promise.all([
clientTxnEventPromise,
serverTxnEventPromise,
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
Expand All @@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
});

expect(serverTxnEvent).toMatchObject({
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)
transaction_info: { source: 'url' },
type: 'transaction',
contexts: {
Expand All @@ -44,8 +46,22 @@ test.describe('distributed tracing', () => {
},
});

const baggage = (data.headers.baggage || null).split(',');

// connected trace
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
expect(baggage).not.toBeNull();

expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
expect(baggage).toEqual(
expect.arrayContaining([
'sentry-sample-rate=1.0',
'sentry-sampled=true',
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
]),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
return txnEvent.transaction.includes('GET /test-param/');
});

const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
page.goto(`/test-param/${PARAM}`),
const res = await page.goto(`/test-param/${PARAM}`);
const data = await res.json();

const [clientTxnEvent, serverTxnEvent] = await Promise.all([
clientTxnEventPromise,
serverTxnEventPromise,
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
Expand All @@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
});

expect(serverTxnEvent).toMatchObject({
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)
transaction_info: { source: 'url' },
type: 'transaction',
contexts: {
Expand All @@ -44,8 +46,22 @@ test.describe('distributed tracing', () => {
},
});

const baggage = (data.headers.baggage || null).split(',');

// connected trace
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
expect(baggage).not.toBeNull();

expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
expect(baggage).toEqual(
expect.arrayContaining([
'sentry-sample-rate=1.0',
'sentry-sampled=true',
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
]),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
return txnEvent.transaction.includes('GET /test-param/');
});

const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
page.goto(`/test-param/${PARAM}`),
const res = await page.goto(`/test-param/${PARAM}`);
const data = await res.json();

const [clientTxnEvent, serverTxnEvent] = await Promise.all([
clientTxnEventPromise,
serverTxnEventPromise,
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
Expand All @@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
});

expect(serverTxnEvent).toMatchObject({
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)`
transaction_info: { source: 'url' },
type: 'transaction',
contexts: {
Expand All @@ -44,8 +46,22 @@ test.describe('distributed tracing', () => {
},
});

const baggage = (data.headers.baggage || null).split(',');

// connected trace
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
expect(baggage).not.toBeNull();

expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
expect(baggage).toEqual(
expect.arrayContaining([
'sentry-sample-rate=1.0',
'sentry-sampled=true',
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
]),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
return txnEvent.transaction.includes('GET /test-param/');
});

const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
page.goto(`/test-param/${PARAM}`),
const res = await page.goto(`/test-param/${PARAM}`);
const data = await res.json();

const [clientTxnEvent, serverTxnEvent] = await Promise.all([
clientTxnEventPromise,
serverTxnEventPromise,
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
Expand All @@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
});

expect(serverTxnEvent).toMatchObject({
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)
transaction_info: { source: 'url' },
type: 'transaction',
contexts: {
Expand All @@ -44,8 +46,22 @@ test.describe('distributed tracing', () => {
},
});

const baggage = (data.headers.baggage || null).split(',');

// connected trace
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
expect(baggage).not.toBeNull();

expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
expect(baggage).toEqual(
expect.arrayContaining([
'sentry-sample-rate=1.0',
'sentry-sampled=true',
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
]),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
return txnEvent.transaction.includes('GET /test-param/');
});

const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
page.goto(`/test-param/${PARAM}`),
const res = await page.goto(`/test-param/${PARAM}`);
const data = await res.json();

const [clientTxnEvent, serverTxnEvent] = await Promise.all([
clientTxnEventPromise,
serverTxnEventPromise,
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
Expand All @@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
});

expect(serverTxnEvent).toMatchObject({
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)
transaction_info: { source: 'url' },
type: 'transaction',
contexts: {
Expand All @@ -44,8 +46,22 @@ test.describe('distributed tracing', () => {
},
});

const baggage = (data.headers.baggage || null).split(',');

// connected trace
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
expect(baggage).not.toBeNull();

expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
expect(baggage).toEqual(
expect.arrayContaining([
'sentry-sample-rate=1.0',
'sentry-sampled=true',
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
]),
);
});
});
Loading