Skip to content

Commit 74460e2

Browse files
committed
fix more tests
1 parent ee66171 commit 74460e2

File tree

7 files changed

+41
-18
lines changed

7 files changed

+41
-18
lines changed

packages/astro/test/server/middleware.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ describe('sentryMiddleware', () => {
5858

5959
expect(startSpanSpy).toHaveBeenCalledWith(
6060
{
61+
attributes: {
62+
'sentry.origin': 'auto.http.astro',
63+
},
6164
data: {
6265
method: 'GET',
6366
url: 'https://mydomain.io/users/123/details',
@@ -66,7 +69,6 @@ describe('sentryMiddleware', () => {
6669
metadata: {},
6770
name: 'GET /users/[id]/details',
6871
op: 'http.server',
69-
origin: 'auto.http.astro',
7072
status: 'ok',
7173
},
7274
expect.any(Function), // the `next` function
@@ -94,6 +96,9 @@ describe('sentryMiddleware', () => {
9496

9597
expect(startSpanSpy).toHaveBeenCalledWith(
9698
{
99+
attributes: {
100+
'sentry.origin': 'auto.http.astro',
101+
},
97102
data: {
98103
method: 'GET',
99104
url: 'http://localhost:1234/a%xx',
@@ -102,7 +107,6 @@ describe('sentryMiddleware', () => {
102107
metadata: {},
103108
name: 'GET a%xx',
104109
op: 'http.server',
105-
origin: 'auto.http.astro',
106110
status: 'ok',
107111
},
108112
expect.any(Function), // the `next` function

packages/nextjs/test/config/withSentry.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as SentryCore from '@sentry/core';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, addTracingExtensions } from '@sentry/core';
2+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, addTracingExtensions } from '@sentry/core';
33
import type { NextApiRequest, NextApiResponse } from 'next';
44

55
import type { AugmentedNextApiResponse, NextApiHandler } from '../../src/common/types';
@@ -44,9 +44,9 @@ describe('withSentry', () => {
4444
{
4545
name: 'GET http://dogs.are.great',
4646
op: 'http.server',
47-
origin: 'auto.http.nextjs',
4847
attributes: {
4948
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
49+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.nextjs',
5050
},
5151
metadata: {
5252
request: expect.objectContaining({ url: 'http://dogs.are.great' }),

packages/nextjs/test/edge/edgeWrapperUtils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ describe('withEdgeWrapping', () => {
8787
},
8888
attributes: {
8989
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
90+
[coreSdk.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.withEdgeWrapping',
9091
},
9192
name: 'some label',
9293
op: 'some op',
93-
origin: 'auto.function.nextjs.withEdgeWrapping',
9494
}),
9595
expect.any(Function),
9696
);

packages/nextjs/test/edge/withSentryAPI.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as coreSdk from '@sentry/core';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
2+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
33

44
import { wrapApiHandlerWithSentry } from '../../src/edge';
55

@@ -58,10 +58,10 @@ describe('wrapApiHandlerWithSentry', () => {
5858
},
5959
attributes: {
6060
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
61+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.withEdgeWrapping',
6162
},
6263
name: 'POST /user/[userId]/post/[postId]',
6364
op: 'http.server',
64-
origin: 'auto.function.nextjs.withEdgeWrapping',
6565
}),
6666
expect.any(Function),
6767
);
@@ -80,10 +80,10 @@ describe('wrapApiHandlerWithSentry', () => {
8080
metadata: {},
8181
attributes: {
8282
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
83+
[coreSdk.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.withEdgeWrapping',
8384
},
8485
name: 'handler (/user/[userId]/post/[postId])',
8586
op: 'http.server',
86-
origin: 'auto.function.nextjs.withEdgeWrapping',
8787
}),
8888
expect.any(Function),
8989
);

packages/sveltekit/test/client/load.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { Load } from '@sveltejs/kit';
33
import { redirect } from '@sveltejs/kit';
44
import { vi } from 'vitest';
55

6+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
67
import { wrapLoadWithSentry } from '../../src/client/load';
78

89
const mockCaptureException = vi.spyOn(SentrySvelte, 'captureException').mockImplementation(() => 'xx');
@@ -82,8 +83,10 @@ describe('wrapLoadWithSentry', () => {
8283
expect(mockStartSpan).toHaveBeenCalledTimes(1);
8384
expect(mockStartSpan).toHaveBeenCalledWith(
8485
{
86+
attributes: {
87+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit',
88+
},
8589
op: 'function.sveltekit.load',
86-
origin: 'auto.function.sveltekit',
8790
name: '/users/[id]',
8891
status: 'ok',
8992
metadata: {
@@ -110,8 +113,10 @@ describe('wrapLoadWithSentry', () => {
110113
expect(mockStartSpan).toHaveBeenCalledTimes(1);
111114
expect(mockStartSpan).toHaveBeenCalledWith(
112115
{
116+
attributes: {
117+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit',
118+
},
113119
op: 'function.sveltekit.load',
114-
origin: 'auto.function.sveltekit',
115120
name: '/users/123',
116121
status: 'ok',
117122
metadata: {

packages/sveltekit/test/server/load.test.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addTracingExtensions } from '@sentry/core';
1+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, addTracingExtensions } from '@sentry/core';
22
import * as SentryNode from '@sentry/node';
33
import type { Load, ServerLoad } from '@sveltejs/kit';
44
import { error, redirect } from '@sveltejs/kit';
@@ -197,8 +197,10 @@ describe('wrapLoadWithSentry calls trace', () => {
197197
expect(mockStartSpan).toHaveBeenCalledTimes(1);
198198
expect(mockStartSpan).toHaveBeenCalledWith(
199199
{
200+
attributes: {
201+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit',
202+
},
200203
op: 'function.sveltekit.load',
201-
origin: 'auto.function.sveltekit',
202204
name: '/users/[id]',
203205
status: 'ok',
204206
metadata: {
@@ -216,8 +218,10 @@ describe('wrapLoadWithSentry calls trace', () => {
216218
expect(mockStartSpan).toHaveBeenCalledTimes(1);
217219
expect(mockStartSpan).toHaveBeenCalledWith(
218220
{
221+
attributes: {
222+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit',
223+
},
219224
op: 'function.sveltekit.load',
220-
origin: 'auto.function.sveltekit',
221225
name: '/users/123',
222226
status: 'ok',
223227
metadata: {
@@ -250,8 +254,10 @@ describe('wrapServerLoadWithSentry calls trace', () => {
250254
expect(mockStartSpan).toHaveBeenCalledTimes(1);
251255
expect(mockStartSpan).toHaveBeenCalledWith(
252256
{
257+
attributes: {
258+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit',
259+
},
253260
op: 'function.sveltekit.server.load',
254-
origin: 'auto.function.sveltekit',
255261
name: '/users/[id]',
256262
parentSampled: true,
257263
parentSpanId: '1234567890abcdef',
@@ -284,8 +290,10 @@ describe('wrapServerLoadWithSentry calls trace', () => {
284290
expect(mockStartSpan).toHaveBeenCalledTimes(1);
285291
expect(mockStartSpan).toHaveBeenCalledWith(
286292
{
293+
attributes: {
294+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit',
295+
},
287296
op: 'function.sveltekit.server.load',
288-
origin: 'auto.function.sveltekit',
289297
name: '/users/[id]',
290298
status: 'ok',
291299
data: {
@@ -306,8 +314,10 @@ describe('wrapServerLoadWithSentry calls trace', () => {
306314
expect(mockStartSpan).toHaveBeenCalledTimes(1);
307315
expect(mockStartSpan).toHaveBeenCalledWith(
308316
{
317+
attributes: {
318+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit',
319+
},
309320
op: 'function.sveltekit.server.load',
310-
origin: 'auto.function.sveltekit',
311321
name: '/users/[id]',
312322
parentSampled: true,
313323
parentSpanId: '1234567890abcdef',
@@ -335,8 +345,10 @@ describe('wrapServerLoadWithSentry calls trace', () => {
335345
expect(mockStartSpan).toHaveBeenCalledTimes(1);
336346
expect(mockStartSpan).toHaveBeenCalledWith(
337347
{
348+
attributes: {
349+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit',
350+
},
338351
op: 'function.sveltekit.server.load',
339-
origin: 'auto.function.sveltekit',
340352
name: '/users/123',
341353
parentSampled: true,
342354
parentSpanId: '1234567890abcdef',

packages/tracing/test/integrations/node/prisma.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ describe('setupOnce', function () {
5454
expect(mockStartSpan).toHaveBeenCalledTimes(1);
5555
expect(mockStartSpan).toHaveBeenLastCalledWith(
5656
{
57+
attributes: {
58+
'sentry.origin': 'auto.db.prisma',
59+
},
5760
name: 'user create',
5861
op: 'db.prisma',
59-
origin: 'auto.db.prisma',
6062
data: { 'db.system': 'postgresql', 'db.prisma.version': '3.1.2', 'db.operation': 'create' },
6163
},
6264
expect.any(Function),

0 commit comments

Comments
 (0)