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 @@ -52,12 +52,29 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {

expect(outboundTransaction.contexts?.trace).toEqual({
data: {
'sentry.source': 'route',
'sentry.origin': 'auto.http.otel.http',
'sentry.op': 'http.server',
'sentry.sample_rate': 1,
url: 'http://localhost:3030/test-outgoing-http',
'otel.kind': 'SERVER',
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.otel.http',
'sentry.source': 'route',
'http.url': 'http://localhost:3030/test-outgoing-http',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-outgoing-http',
'http.user_agent': 'axios/1.6.7',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-outgoing-http',
},
op: 'http.server',
span_id: expect.any(String),
Expand All @@ -68,12 +85,28 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {

expect(inboundTransaction.contexts?.trace).toEqual({
data: {
'sentry.source': 'route',
'sentry.origin': 'auto.http.otel.http',
'sentry.op': 'http.server',
'sentry.sample_rate': 1,
url: 'http://localhost:3030/test-inbound-headers',
'otel.kind': 'SERVER',
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.otel.http',
'sentry.source': 'route',
'http.url': 'http://localhost:3030/test-inbound-headers',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-inbound-headers',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-inbound-headers',
},
op: 'http.server',
parent_span_id: outgoingHttpSpanId,
Expand Down Expand Up @@ -133,12 +166,29 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {

expect(outboundTransaction.contexts?.trace).toEqual({
data: {
'sentry.source': 'route',
'sentry.origin': 'auto.http.otel.http',
'sentry.op': 'http.server',
'sentry.sample_rate': 1,
url: 'http://localhost:3030/test-outgoing-fetch',
'otel.kind': 'SERVER',
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.otel.http',
'sentry.source': 'route',
'http.url': 'http://localhost:3030/test-outgoing-fetch',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-outgoing-fetch',
'http.user_agent': 'axios/1.6.7',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-outgoing-fetch',
},
op: 'http.server',
span_id: expect.any(String),
Expand All @@ -149,12 +199,28 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {

expect(inboundTransaction.contexts?.trace).toEqual({
data: expect.objectContaining({
'sentry.source': 'route',
'sentry.origin': 'auto.http.otel.http',
'sentry.op': 'http.server',
'sentry.sample_rate': 1,
url: 'http://localhost:3030/test-inbound-headers',
'otel.kind': 'SERVER',
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.otel.http',
'sentry.source': 'route',
'http.url': 'http://localhost:3030/test-inbound-headers',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-inbound-headers',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-inbound-headers',
}),
op: 'http.server',
parent_span_id: outgoingHttpSpanId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,29 @@ test('Sends an API route transaction', async ({ baseURL }) => {

expect(transactionEvent.contexts?.trace).toEqual({
data: {
'sentry.source': 'route',
'sentry.origin': 'auto.http.otel.http',
'sentry.op': 'http.server',
'sentry.sample_rate': 1,
url: 'http://localhost:3030/test-transaction',
'otel.kind': 'SERVER',
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.otel.http',
'sentry.source': 'route',
'http.url': 'http://localhost:3030/test-transaction',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-transaction',
'http.user_agent': 'axios/1.6.7',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-transaction',
},
op: 'http.server',
span_id: expect.any(String),
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/tracing/dynamicSamplingContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export function getDynamicSamplingContextFromSpan(span: Span): Readonly<Partial<
return {};
}

// passing emit=false here to only emit later once the DSC is actually populated
const dsc = getDynamicSamplingContextFromClient(spanToJSON(span).trace_id || '', client);

// TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext
Expand Down
39 changes: 29 additions & 10 deletions packages/node-experimental/test/integration/scope.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,33 @@ describe('Integration | Scope', () => {
await client.flush();

expect(beforeSend).toHaveBeenCalledTimes(1);

if (spanId) {
expect(beforeSend).toHaveBeenCalledWith(
expect.objectContaining({
contexts: expect.objectContaining({
trace: {
span_id: spanId,
trace_id: traceId,
},
}),
}),
{
event_id: expect.any(String),
originalException: error,
syntheticException: expect.any(Error),
},
);
}

expect(beforeSend).toHaveBeenCalledWith(
expect.objectContaining({
contexts: expect.objectContaining({
trace: spanId
? {
span_id: spanId,
trace_id: traceId,
parent_span_id: undefined,
}
: expect.any(Object),
}),
tags: {
tag1: 'val1',
tag2: 'val2',
tag3: 'val3',
tag4: 'val4',
...(enableTracing ? { transaction: 'outer' } : {}),
},
}),
{
Expand All @@ -88,7 +99,12 @@ describe('Integration | Scope', () => {
expect.objectContaining({
contexts: expect.objectContaining({
trace: {
data: { 'otel.kind': 'INTERNAL', 'sentry.origin': 'manual', 'sentry.source': 'custom' },
data: {
'otel.kind': 'INTERNAL',
'sentry.origin': 'manual',
'sentry.source': 'custom',
'sentry.sample_rate': 1,
},
span_id: spanId,
status: 'ok',
trace_id: traceId,
Expand All @@ -102,6 +118,7 @@ describe('Integration | Scope', () => {
tag2: 'val2',
tag3: 'val3',
tag4: 'val4',
transaction: 'outer',
},
timestamp: expect.any(Number),
transaction: 'outer',
Expand Down Expand Up @@ -186,6 +203,7 @@ describe('Integration | Scope', () => {
tag2: 'val2a',
tag3: 'val3a',
tag4: 'val4a',
...(enableTracing ? { transaction: 'outer' } : {}),
},
}),
{
Expand All @@ -211,6 +229,7 @@ describe('Integration | Scope', () => {
tag2: 'val2b',
tag3: 'val3b',
tag4: 'val4b',
...(enableTracing ? { transaction: 'outer' } : {}),
},
}),
{
Expand Down
Loading