Skip to content
Draft
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 @@ -48,7 +48,7 @@ sentryTest('should update spans for GraphQL fetch requests', async ({ getLocalTe
status: 'ok',
data: expect.objectContaining({
type: 'fetch',
'http.method': 'POST',
'http.request.method': 'POST',
'url.full': 'http://sentry-test.io/foo',
'server.address': 'sentry-test.io',
'sentry.op': 'http.client',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sentryTest('should update spans for GraphQL persisted query fetch requests', asy
status: 'ok',
data: expect.objectContaining({
type: 'fetch',
'http.method': 'POST',
'http.request.method': 'POST',
'url.full': 'http://sentry-test.io/graphql',
'server.address': 'sentry-test.io',
'sentry.op': 'http.client',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sentryTest('should update spans for GraphQL persisted query XHR requests', async
status: 'ok',
data: {
type: 'xhr',
'http.method': 'POST',
'http.request.method': 'POST',
'url.full': 'http://sentry-test.io/graphql',
'server.address': 'sentry-test.io',
'sentry.op': 'http.client',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sentryTest('should update spans for GraphQL XHR requests', async ({ getLocalTest
status: 'ok',
data: {
type: 'xhr',
'http.method': 'POST',
'http.request.method': 'POST',
'url.full': 'http://sentry-test.io/foo',
'server.address': 'sentry-test.io',
'sentry.op': 'http.client',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
integrations: [Sentry.spanStreamingIntegration()],
ignoreSpans: [{ attributes: { 'http.status_code': 200 } }],
ignoreSpans: [{ attributes: { 'http.response.status_code': 200 } }],
tracesSampleRate: 1,
debug: true,
});
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// This segment span matches ignoreSpans via attributes — segment + child should be dropped
Sentry.startSpan({ name: 'health-check', attributes: { 'http.status_code': 200 } }, () => {
Sentry.startSpan({ name: 'health-check', attributes: { 'http.response.status_code': 200 } }, () => {
Sentry.startSpan({ name: 'child-of-ignored' }, () => {});
});

setTimeout(() => {
// This segment span does NOT match — segment + child should be sent
Sentry.startSpan({ name: 'normal-segment', attributes: { 'http.status_code': 500 } }, () => {
Sentry.startSpan({ name: 'normal-segment', attributes: { 'http.response.status_code': 500 } }, () => {
Sentry.startSpan({ name: 'child-span' }, () => {});
});
}, 1000);
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
// The init bundle script is served from the test origin: its description is origin-relative,
// but `url.full` retains the full absolute URL (needed for span description inference).
const sameOriginScriptSpan = scriptSpans?.find(({ description }) => description === '/init.bundle.js');
expect(sameOriginScriptSpan?.data?.['url.same_origin']).toBe(true);
expect(sameOriginScriptSpan?.data?.['http.request.same_origin']).toBe(true);
expect(sameOriginScriptSpan?.data?.['url.full']).toMatch(/^https?:\/\/.+\/init\.bundle\.js$/);

const customScriptSpan = scriptSpans?.find(
Expand All @@ -78,8 +78,8 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
expect(imgSpan).toEqual({
data: {
'http.decoded_response_content_length': expect.any(Number),
'http.response_content_length': expect.any(Number),
'http.response_transfer_size': expect.any(Number),
'http.response.body.size': expect.any(Number),
'http.response.size': expect.any(Number),
'http.request.connect_start': expect.any(Number),
'http.request.connection_end': expect.any(Number),
'http.request.domain_lookup_end': expect.any(Number),
Expand All @@ -98,7 +98,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.img',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics',
'server.address': 'sentry-test-site.example',
'url.same_origin': false,
'http.request.same_origin': false,
'url.scheme': 'https',
'url.full': 'https://sentry-test-site.example/path/to/image.svg',
...(!isWebkitRun && {
Expand Down Expand Up @@ -127,8 +127,8 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
expect(linkSpan).toEqual({
data: {
'http.decoded_response_content_length': expect.any(Number),
'http.response_content_length': expect.any(Number),
'http.response_transfer_size': expect.any(Number),
'http.response.body.size': expect.any(Number),
'http.response.size': expect.any(Number),
'http.request.connect_start': expect.any(Number),
'http.request.connection_end': expect.any(Number),
'http.request.domain_lookup_end': expect.any(Number),
Expand All @@ -147,7 +147,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.link',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics',
'server.address': 'sentry-test-site.example',
'url.same_origin': false,
'http.request.same_origin': false,
'url.scheme': 'https',
'url.full': 'https://sentry-test-site.example/path/to/style.css',
...(!isWebkitRun && {
Expand All @@ -170,8 +170,8 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
expect(customScriptSpan).toEqual({
data: {
'http.decoded_response_content_length': expect.any(Number),
'http.response_content_length': expect.any(Number),
'http.response_transfer_size': expect.any(Number),
'http.response.body.size': expect.any(Number),
'http.response.size': expect.any(Number),
'http.request.connection_end': expect.any(Number),
'http.request.connect_start': expect.any(Number),
'http.request.domain_lookup_end': expect.any(Number),
Expand All @@ -190,7 +190,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
'sentry.op': 'resource.script',
'sentry.origin': 'auto.resource.browser.metrics',
'server.address': 'sentry-test-site.example',
'url.same_origin': false,
'http.request.same_origin': false,
'url.scheme': 'https',
'url.full': 'https://sentry-test-site.example/path/to/script.js',
...(!isWebkitRun && {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sentryTest('sanitizes data URLs in fetch span name and attributes', async ({ get
expect(span?.description).toBe(`GET ${sanitizedUrl}`);

expect(span?.data).toMatchObject({
'http.method': 'GET',
'http.request.method': 'GET',
type: 'fetch',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sentryTest('should create spans for fetch requests called directly after init',
timestamp: expect.any(Number),
trace_id: tracingEvent.contexts?.trace?.trace_id,
data: {
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test-site.example/0',
'server.address': 'sentry-test-site.example',
type: 'fetch',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p
timestamp: expect.any(Number),
trace_id: tracingEvent.contexts?.trace?.trace_id,
data: {
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': `${TEST_HOST}/test-req/${index}`,
'server.address': 'sentry-test.io',
type: 'fetch',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sentryTest(
expect(streamSpan).toMatchObject({
name: 'GET http://sentry-test-site.example/delayed',
attributes: expect.objectContaining({
'http.method': { type: 'string', value: 'GET' },
'http.request.method': { type: 'string', value: 'GET' },
'url.full': { type: 'string', value: 'http://sentry-test-site.example/delayed' },
type: { type: 'string', value: 'fetch' },
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sentryTest('creates spans for fetch requests', async ({ getLocalTestUrl, page })
end_timestamp: expect.any(Number),
trace_id: pageloadSpan?.trace_id,
attributes: expect.objectContaining({
'http.method': { type: 'string', value: 'GET' },
'http.request.method': { type: 'string', value: 'GET' },
'url.full': { type: 'string', value: `http://sentry-test-site.example/${index}` },
'server.address': { type: 'string', value: 'sentry-test-site.example' },
type: { type: 'string', value: 'fetch' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ sentryTest('strips query params in fetch request spans', async ({ getLocalTestUr
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test-site.example/0?id=123;page=5',
'url.query': 'id=123;page=5',
'http.response.status_code': 200,
'http.response_content_length': 2,
'http.response.body.size': 2,
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.browser',
type: 'fetch',
Expand Down Expand Up @@ -71,11 +71,11 @@ sentryTest('strips hash fragment in fetch request spans', async ({ getLocalTestU
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test-site.example/1#fragment',
'url.fragment': 'fragment',
'http.response.status_code': 200,
'http.response_content_length': 2,
'http.response.body.size': 2,
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.browser',
type: 'fetch',
Expand Down Expand Up @@ -113,12 +113,12 @@ sentryTest('strips hash fragment and query params in fetch request spans', async
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test-site.example/2?id=1#fragment',
'url.query': 'id=1',
'url.fragment': 'fragment',
'http.response.status_code': 200,
'http.response_content_length': 2,
'http.response.body.size': 2,
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.browser',
type: 'fetch',
Expand Down Expand Up @@ -156,12 +156,12 @@ sentryTest(
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test.io/api/users?id=1#fragment',
'url.query': 'id=1',
'url.fragment': 'fragment',
'http.response.status_code': 200,
'http.response_content_length': 2,
'http.response.body.size': 2,
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.browser',
type: 'fetch',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p
timestamp: expect.any(Number),
trace_id: tracingEvent.contexts?.trace?.trace_id,
data: {
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': `http://sentry-test-site.example/${index}`,
'server.address': 'sentry-test-site.example',
type: 'fetch',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sentryTest('sanitizes data URLs in XHR span name and attributes', async ({ getLo
expect(span?.description).toBe(`GET ${sanitizedUrl}`);

expect(span?.data).toMatchObject({
'http.method': 'GET',
'http.request.method': 'GET',
type: 'xhr',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sentryTest('should create spans for xhr requests', async ({ getLocalTestUrl, pag
timestamp: expect.any(Number),
trace_id: tracingEvent.contexts?.trace?.trace_id,
data: {
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': `${TEST_HOST}/test-req/${index}`,
'server.address': 'sentry-test.io',
type: 'xhr',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sentryTest('creates spans for XHR requests', async ({ getLocalTestUrl, page }) =
end_timestamp: expect.any(Number),
trace_id: pageloadSpan?.trace_id,
attributes: expect.objectContaining({
'http.method': { type: 'string', value: 'GET' },
'http.request.method': { type: 'string', value: 'GET' },
'url.full': { type: 'string', value: `http://sentry-test-site.example/${index}` },
'server.address': { type: 'string', value: 'sentry-test-site.example' },
type: { type: 'string', value: 'xhr' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sentryTest('strips query params in XHR request spans', async ({ getLocalTestUrl,
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test-site.example/0?id=123;page=5',
'url.query': 'id=123;page=5',
'http.response.status_code': 200,
Expand Down Expand Up @@ -70,7 +70,7 @@ sentryTest('strips hash fragment in XHR request spans', async ({ getLocalTestUrl
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test-site.example/1#fragment',
'url.fragment': 'fragment',
'http.response.status_code': 200,
Expand Down Expand Up @@ -111,7 +111,7 @@ sentryTest('strips hash fragment and query params in XHR request spans', async (
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test-site.example/2?id=1#fragment',
'url.query': 'id=1',
'url.fragment': 'fragment',
Expand Down Expand Up @@ -153,7 +153,7 @@ sentryTest(
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': 'http://sentry-test.io/api/users?id=1#fragment',
'url.query': 'id=1',
'url.fragment': 'fragment',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sentryTest('should create spans for XHR requests', async ({ getLocalTestUrl, pag
timestamp: expect.any(Number),
trace_id: eventData.contexts?.trace?.trace_id,
data: {
'http.method': 'GET',
'http.request.method': 'GET',
'url.full': `http://sentry-test-site.example/${index}`,
'server.address': 'sentry-test-site.example',
type: 'xhr',
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/bun-integration-tests/suites/fetch/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ it('creates an http.client span for outgoing fetch requests', async ({ signal })
origin: 'auto.http.fetch',
description: expect.stringMatching(/^GET http:\/\/localhost:\d+\/allowed$/),
data: expect.objectContaining({
'http.method': 'GET',
'http.request.method': 'GET',
type: 'fetch',
}),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ test("preserves the baseline client.* and network.* server span attributes that
const data = transaction.contexts?.trace?.data ?? {};

if (RUNTIME === 'node') {
expect(data['net.host.name']).toBe('localhost');
expect(data['net.transport']).toBe('ip_tcp');
expect(data['net.host.ip']).toEqual(expect.any(String));
expect(data['net.peer.ip']).toEqual(expect.any(String));
expect(data['net.peer.port']).toEqual(expect.any(Number));
expect(data['server.address']).toBe('localhost');
expect(data['network.transport']).toBe('ip_tcp');
expect(data['network.local.address']).toEqual(expect.any(String));
expect(data['network.peer.address']).toEqual(expect.any(String));
expect(data['server.port']).toEqual(expect.any(Number));
} else if (RUNTIME === 'bun') {
// Doesn't set net.*, network.*, or client.* attributes
} else if (RUNTIME === 'cloudflare') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ test('Sends an API route transaction', async ({ baseURL }) => {
'http.response.status_code': 200,
'url.full': 'http://localhost:3030/test-transaction',
'url.path': '/test-transaction',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-transaction',
'http.user_agent': 'node',
'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,
'server.address': 'localhost:3030',
'server.address': 'localhost',
'http.request.method': 'GET',
'url.scheme': 'http',
'url.path': '/test-transaction',
'user_agent.original': 'node',
'network.protocol.version': '1.1',
'network.transport': 'ip_tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'server.port': expect.any(Number),
'http.response.status_code': 200,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

E2E tests remap peer port wrongly

High Severity

These toEqual payloads list server.address twice and map net.peer.port to server.port. The second key wins, so the Host-header address is never asserted, and the extra network.peer.port the SDK still emits makes the strict equality fail. I flagged this because the testing conventions in the review rules require tests to assert the new attributes thoroughly.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 701694c. Configure here.

'http.status_text': 'OK',
'http.route': '/test-transaction',
'http.request.header.accept': '*/*',
Expand Down
Loading
Loading