Skip to content

Commit d3c7430

Browse files
committed
ref(cloudflare): Adjust event mechanisms and durable object origin
1 parent 8077201 commit d3c7430

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

dev-packages/cloudflare-integration-tests/suites/basic/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ it('Basic error in fetch handler', async () => {
1515
stacktrace: {
1616
frames: expect.any(Array),
1717
},
18-
mechanism: { type: 'cloudflare', handled: false },
18+
mechanism: { type: 'auto.http.cloudflare', handled: false },
1919
},
2020
],
2121
},

dev-packages/cloudflare-integration-tests/suites/tracing/durableobject/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ it('traces a durable object method', async () => {
1212
op: 'rpc',
1313
data: expect.objectContaining({
1414
'sentry.op': 'rpc',
15-
'sentry.origin': 'auto.faas.cloudflare_durableobjects',
15+
'sentry.origin': 'auto.faas.cloudflare.durable_object',
1616
}),
17-
origin: 'auto.faas.cloudflare_durableobjects',
17+
origin: 'auto.faas.cloudflare.durable_object',
1818
}),
1919
}),
2020
transaction: 'sayHello',

dev-packages/e2e-tests/test-applications/cloudflare-workers/tests/index.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test("worker's withSentry", async ({ baseURL }) => {
2020

2121
test('RPC method which throws an exception to be logged to sentry', async ({ baseURL }) => {
2222
const eventWaiter = waitForError('cloudflare-workers', event => {
23-
return event.exception?.values?.[0]?.mechanism?.type === 'cloudflare_durableobject';
23+
return event.exception?.values?.[0]?.mechanism?.type === 'auto.faas.cloudflare.durable_object';
2424
});
2525
const response = await fetch(`${baseURL}/rpc/throwException`);
2626
expect(response.status).toBe(500);
@@ -29,7 +29,7 @@ test('RPC method which throws an exception to be logged to sentry', async ({ bas
2929
});
3030
test("Request processed by DurableObject's fetch is recorded", async ({ baseURL }) => {
3131
const eventWaiter = waitForError('cloudflare-workers', event => {
32-
return event.exception?.values?.[0]?.mechanism?.type === 'cloudflare_durableobject';
32+
return event.exception?.values?.[0]?.mechanism?.type === 'auto.faas.cloudflare.durable_object';
3333
});
3434
const response = await fetch(`${baseURL}/pass-to-object/throwException`);
3535
expect(response.status).toBe(500);
@@ -38,7 +38,7 @@ test("Request processed by DurableObject's fetch is recorded", async ({ baseURL
3838
});
3939
test('Websocket.webSocketMessage', async ({ baseURL }) => {
4040
const eventWaiter = waitForError('cloudflare-workers', event => {
41-
return event.exception?.values?.[0]?.mechanism?.type === 'cloudflare_durableobject';
41+
return event.exception?.values?.[0]?.mechanism?.type === 'auto.faas.cloudflare.durable_object';
4242
});
4343
const url = new URL('/pass-to-object/ws', baseURL);
4444
url.protocol = url.protocol.replace('http', 'ws');
@@ -53,7 +53,7 @@ test('Websocket.webSocketMessage', async ({ baseURL }) => {
5353

5454
test('Websocket.webSocketClose', async ({ baseURL }) => {
5555
const eventWaiter = waitForError('cloudflare-workers', event => {
56-
return event.exception?.values?.[0]?.mechanism?.type === 'cloudflare_durableobject';
56+
return event.exception?.values?.[0]?.mechanism?.type === 'auto.faas.cloudflare.durable_object';
5757
});
5858
const url = new URL('/pass-to-object/ws', baseURL);
5959
url.protocol = url.protocol.replace('http', 'ws');

packages/cloudflare/src/durableobject.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function wrapMethodWithSentry<T extends OriginalMethod>(
7979
(e: unknown) => {
8080
captureException(e, {
8181
mechanism: {
82-
type: 'cloudflare_durableobject',
82+
type: 'auto.faas.cloudflare.durable_object',
8383
handled: false,
8484
},
8585
});
@@ -106,7 +106,7 @@ function wrapMethodWithSentry<T extends OriginalMethod>(
106106
const attributes = wrapperOptions.spanOp
107107
? {
108108
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: wrapperOptions.spanOp,
109-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare_durableobjects',
109+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.durable_object',
110110
}
111111
: {};
112112

@@ -123,7 +123,7 @@ function wrapMethodWithSentry<T extends OriginalMethod>(
123123
(e: unknown) => {
124124
captureException(e, {
125125
mechanism: {
126-
type: 'cloudflare_durableobject',
126+
type: 'auto.faas.cloudflare.durable_object',
127127
handled: false,
128128
},
129129
});
@@ -138,7 +138,7 @@ function wrapMethodWithSentry<T extends OriginalMethod>(
138138
} catch (e) {
139139
captureException(e, {
140140
mechanism: {
141-
type: 'cloudflare_durableobject',
141+
type: 'auto.faas.cloudflare.durable_object',
142142
handled: false,
143143
},
144144
});

packages/cloudflare/src/handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
5959
apply(target, thisArg, args) {
6060
const [err] = args;
6161

62-
captureException(err, { mechanism: { handled: false, type: 'cloudflare' } });
62+
captureException(err, { mechanism: { handled: false, type: 'auto.faas.cloudflare.error_handler' } });
6363

6464
return Reflect.apply(target, thisArg, args);
6565
},
@@ -97,7 +97,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
9797
try {
9898
return await (target.apply(thisArg, args) as ReturnType<typeof target>);
9999
} catch (e) {
100-
captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });
100+
captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.scheduled' } });
101101
throw e;
102102
} finally {
103103
waitUntil(flush(2000));
@@ -138,7 +138,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
138138
try {
139139
return await (target.apply(thisArg, args) as ReturnType<typeof target>);
140140
} catch (e) {
141-
captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });
141+
captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.email' } });
142142
throw e;
143143
} finally {
144144
waitUntil(flush(2000));
@@ -188,7 +188,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
188188
try {
189189
return await (target.apply(thisArg, args) as ReturnType<typeof target>);
190190
} catch (e) {
191-
captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });
191+
captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.queue' } });
192192
throw e;
193193
} finally {
194194
waitUntil(flush(2000));
@@ -220,7 +220,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
220220
try {
221221
return await (target.apply(thisArg, args) as ReturnType<typeof target>);
222222
} catch (e) {
223-
captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });
223+
captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.tail' } });
224224
throw e;
225225
} finally {
226226
waitUntil(flush(2000));

packages/cloudflare/src/request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function wrapRequestHandler(
8484
return await handler();
8585
} catch (e) {
8686
if (captureErrors) {
87-
captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });
87+
captureException(e, { mechanism: { handled: false, type: 'auto.http.cloudflare' } });
8888
}
8989
throw e;
9090
} finally {
@@ -110,7 +110,7 @@ export function wrapRequestHandler(
110110
return res;
111111
} catch (e) {
112112
if (captureErrors) {
113-
captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });
113+
captureException(e, { mechanism: { handled: false, type: 'auto.http.cloudflare' } });
114114
}
115115
throw e;
116116
} finally {

packages/cloudflare/src/workflows.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class WrappedWorkflowStep implements WorkflowStep {
103103
span.setStatus({ code: 1 });
104104
return result;
105105
} catch (error) {
106-
captureException(error, { mechanism: { handled: true, type: 'cloudflare' } });
106+
captureException(error, { mechanism: { handled: true, type: 'auto.faas.cloudflare.workflow' } });
107107
throw error;
108108
} finally {
109109
this._ctx.waitUntil(flush(2000));

packages/cloudflare/test/handler.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ describe('withSentry', () => {
305305

306306
expect(captureExceptionSpy).toHaveBeenCalledTimes(1);
307307
expect(captureExceptionSpy).toHaveBeenLastCalledWith(error, {
308-
mechanism: { handled: false, type: 'cloudflare' },
308+
mechanism: { handled: false, type: 'auto.faas.cloudflare.scheduled' },
309309
});
310310
});
311311

@@ -545,7 +545,7 @@ describe('withSentry', () => {
545545

546546
expect(captureExceptionSpy).toHaveBeenCalledTimes(1);
547547
expect(captureExceptionSpy).toHaveBeenLastCalledWith(error, {
548-
mechanism: { handled: false, type: 'cloudflare' },
548+
mechanism: { handled: false, type: 'auto.faas.cloudflare.email' },
549549
});
550550
});
551551

@@ -784,7 +784,7 @@ describe('withSentry', () => {
784784

785785
expect(captureExceptionSpy).toHaveBeenCalledTimes(1);
786786
expect(captureExceptionSpy).toHaveBeenLastCalledWith(error, {
787-
mechanism: { handled: false, type: 'cloudflare' },
787+
mechanism: { handled: false, type: 'auto.faas.cloudflare.queue' },
788788
});
789789
});
790790

@@ -1027,7 +1027,7 @@ describe('withSentry', () => {
10271027

10281028
expect(captureExceptionSpy).toHaveBeenCalledTimes(1);
10291029
expect(captureExceptionSpy).toHaveBeenLastCalledWith(error, {
1030-
mechanism: { handled: false, type: 'cloudflare' },
1030+
mechanism: { handled: false, type: 'auto.faas.cloudflare.tail' },
10311031
});
10321032
});
10331033

@@ -1102,7 +1102,7 @@ describe('withSentry', () => {
11021102

11031103
expect(captureExceptionSpy).toHaveBeenCalledTimes(1);
11041104
expect(captureExceptionSpy).toHaveBeenLastCalledWith(error, {
1105-
mechanism: { handled: false, type: 'cloudflare' },
1105+
mechanism: { handled: false, type: 'auto.faas.cloudflare.error_handler' },
11061106
});
11071107
expect(errorHandlerResponse?.status).toBe(500);
11081108
});

packages/cloudflare/test/request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ describe('withSentry', () => {
192192

193193
expect(captureExceptionSpy).toHaveBeenCalledTimes(1);
194194
expect(captureExceptionSpy).toHaveBeenLastCalledWith(error, {
195-
mechanism: { handled: false, type: 'cloudflare' },
195+
mechanism: { handled: false, type: 'auto.http.cloudflare' },
196196
});
197197
});
198198

packages/cloudflare/test/workflow.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => {
272272
expect.objectContaining({
273273
type: 'Error',
274274
value: 'Test error',
275-
mechanism: { type: 'cloudflare', handled: true },
275+
mechanism: { type: 'auto.faas.cloudflare.workflow', handled: true },
276276
}),
277277
],
278278
},

0 commit comments

Comments
 (0)