Skip to content

Commit d2f0457

Browse files
committed
test: Add sentry.is_localhost to remaining exact span assertions
Covers the cases the first pass missed: the nestjs `@SentryTraced` helper (reached via `toEqual(tracedSpan(...))` rather than an object literal) and the redis/postgres suites, which need Docker and so only surfaced in CI.
1 parent 040cd31 commit d2f0457

7 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎dev-packages/e2e-tests/test-applications/nestjs-12/tests/span-decorator.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ function tracedSpan(segmentSpan: SerializedStreamedSpan, name: string, op: strin
1919
status: 'ok',
2020
attributes: {
2121
'sentry.trace_lifecycle': { type: 'string', value: 'stream' },
22+
// The e2e app is served over localhost (`baseURL: http://localhost:<port>`).
23+
'sentry.is_localhost': { type: 'boolean', value: true },
2224
'sentry.segment.name': { type: 'string', value: segmentSpan.name },
2325
'sentry.segment.id': { type: 'string', value: segmentSpan.span_id },
2426
'sentry.sdk.name': { type: 'string', value: 'sentry.javascript.nestjs' },

‎dev-packages/e2e-tests/test-applications/nestjs-basic/tests/span-decorator.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ function tracedSpan(segmentSpan: SerializedStreamedSpan, name: string, op: strin
1919
status: 'ok',
2020
attributes: {
2121
'sentry.trace_lifecycle': { type: 'string', value: 'stream' },
22+
// The e2e app is served over localhost (`baseURL: http://localhost:<port>`).
23+
'sentry.is_localhost': { type: 'boolean', value: true },
2224
'sentry.segment.name': { type: 'string', value: segmentSpan.name },
2325
'sentry.segment.id': { type: 'string', value: segmentSpan.span_id },
2426
'sentry.sdk.name': { type: 'string', value: 'sentry.javascript.nestjs' },

‎dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ describeWithDockerCompose(
144144
}),
145145
'sentry.sdk.version': { type: 'string', value: expect.any(String) },
146146
'sentry.segment.id': { type: 'string', value: expect.stringMatching(/^[\da-f]{16}$/) },
147+
'sentry.is_localhost': { type: 'boolean', value: false },
147148
},
148149
end_timestamp: expect.any(Number),
149150
is_segment: false,

‎dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose
1212
const QUERY_ORIGIN = 'auto.db.postgres';
1313

1414
const COMMON_DB_ATTRIBUTES = {
15+
'sentry.is_localhost': {
16+
type: 'boolean',
17+
value: false,
18+
},
1519
'db.connection_string': {
1620
type: 'string',
1721
value: expect.stringMatching(/^postgresql:\/\/localhost:\d+\/tests$/),

‎dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ describeWithDockerCompose('redis cache auto instrumentation', { workingDirectory
710710
[SENTRY_TRACE_LIFECYCLE]: 'stream',
711711
}),
712712
'sentry.sdk.version': { type: 'string', value: expect.any(String) },
713+
'sentry.is_localhost': { type: 'boolean', value: false },
713714
'sentry.segment.id': { type: 'string', value: expect.stringMatching(/^[\da-f]{16}$/) },
714715
});
715716

‎dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ describeWithDockerCompose(
192192
}),
193193
'sentry.sdk.version': { type: 'string', value: expect.any(String) },
194194
'sentry.segment.id': { type: 'string', value: expect.stringMatching(/^[\da-f]{16}$/) },
195+
'sentry.is_localhost': { type: 'boolean', value: false },
195196
},
196197
end_timestamp: expect.any(Number),
197198
is_segment: false,

‎dev-packages/node-integration-tests/suites/tracing/redis/test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ describeWithDockerCompose('redis auto instrumentation', { workingDirectory: [__d
7676
// statement is reported through `db.query.text` alone and the name becomes
7777
// `{db.operation.name} {server.address}:{server.port}`.
7878
const COMMON_ATTRIBUTES = {
79+
'sentry.is_localhost': { type: 'boolean', value: false },
7980
'db.system.name': { type: 'string', value: 'redis' },
8081
'server.address': { type: 'string', value: 'localhost' },
8182
'server.port': { type: 'integer', value: 6380 },

0 commit comments

Comments
 (0)