Skip to content

Commit 1d59d8a

Browse files
authored
ref(aws-serverless): Add type to captured event mechanism (#17248)
see #17212 closes #17247
1 parent 8f4d56f commit 1d59d8a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/aws-serverless/src/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ export function wrapHandler<TEvent, TResult>(
306306
if (options.captureAllSettledReasons && Array.isArray(rv) && isPromiseAllSettledResult(rv)) {
307307
const reasons = getRejectedReasons(rv);
308308
reasons.forEach(exception => {
309-
captureException(exception, scope => markEventUnhandled(scope));
309+
captureException(exception, scope => markEventUnhandled(scope, 'auto.function.aws-serverless.promise'));
310310
});
311311
}
312312
} catch (e) {
313-
captureException(e, scope => markEventUnhandled(scope));
313+
captureException(e, scope => markEventUnhandled(scope, 'auto.function.aws-serverless.handler'));
314314
throw e;
315315
} finally {
316316
clearTimeout(timeoutWarningTimer);

packages/aws-serverless/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ const headerGetter: TextMapGetter<APIGatewayProxyEventHeaders> = {
2626
/**
2727
* Marks an event as unhandled by adding a span processor to the passed scope.
2828
*/
29-
export function markEventUnhandled(scope: Scope): Scope {
29+
export function markEventUnhandled(scope: Scope, type: string): Scope {
3030
scope.addEventProcessor(event => {
31-
addExceptionMechanism(event, { handled: false });
31+
addExceptionMechanism(event, { handled: false, type });
3232
return event;
3333
});
3434

packages/aws-serverless/test/sdk.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ describe('AWSLambda', () => {
501501
// @ts-expect-error just mocking around...
502502
expect(evtProcessor(event).exception.values[0]?.mechanism).toEqual({
503503
handled: false,
504-
type: 'generic',
504+
type: 'auto.function.aws-serverless.handler',
505505
});
506506
}
507507
});

0 commit comments

Comments
 (0)