Skip to content

Commit 8077201

Browse files
authored
ref(aws-severless): Slightly adjust aws-serverless mechanism type (#17614)
should have used snake_case instead of kebab-case
1 parent a4ffb19 commit 8077201

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

dev-packages/e2e-tests/test-applications/aws-serverless/tests/layer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ test.describe('Lambda layer', () => {
160160
type: 'Error',
161161
value: 'test',
162162
mechanism: {
163-
type: 'auto.function.aws-serverless.otel',
163+
type: 'auto.function.aws_serverless.otel',
164164
handled: false,
165165
},
166166
}),
@@ -188,7 +188,7 @@ test.describe('Lambda layer', () => {
188188
type: 'Error',
189189
value: 'test esm',
190190
mechanism: {
191-
type: 'auto.function.aws-serverless.otel',
191+
type: 'auto.function.aws_serverless.otel',
192192
handled: false,
193193
},
194194
}),

packages/aws-serverless/src/integration/awslambda.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const instrumentAwsLambda = generateInstrumentOnce(
2929
},
3030
responseHook(_span, { err }) {
3131
if (err) {
32-
captureException(err, scope => markEventUnhandled(scope, 'auto.function.aws-serverless.otel'));
32+
captureException(err, scope => markEventUnhandled(scope, 'auto.function.aws_serverless.otel'));
3333
}
3434
},
3535
};

packages/aws-serverless/src/sdk.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,13 @@ export function wrapHandler<TEvent, TResult>(
235235
if (options.captureAllSettledReasons && Array.isArray(rv) && isPromiseAllSettledResult(rv)) {
236236
const reasons = getRejectedReasons(rv);
237237
reasons.forEach(exception => {
238-
captureException(exception, scope => markEventUnhandled(scope, 'auto.function.aws-serverless.promise'));
238+
captureException(exception, scope => markEventUnhandled(scope, 'auto.function.aws_serverless.promise'));
239239
});
240240
}
241241
} catch (e) {
242242
// Errors should already captured in the instrumentation's `responseHook`,
243243
// we capture them here just to be safe. Double captures are deduplicated by the SDK.
244-
captureException(e, scope => markEventUnhandled(scope, 'auto.function.aws-serverless.handler'));
244+
captureException(e, scope => markEventUnhandled(scope, 'auto.function.aws_serverless.handler'));
245245
throw e;
246246
} finally {
247247
clearTimeout(timeoutWarningTimer);
@@ -281,14 +281,14 @@ function wrapStreamingHandler<TEvent, TResult>(
281281
enhanceScopeWithEnvironmentData(scope, context, startTime);
282282

283283
responseStream.on('error', error => {
284-
captureException(error, scope => markEventUnhandled(scope, 'auto.function.aws-serverless.stream'));
284+
captureException(error, scope => markEventUnhandled(scope, 'auto.function.aws_serverless.stream'));
285285
});
286286

287287
return await handler(event, responseStream, context);
288288
} catch (e) {
289289
// Errors should already captured in the instrumentation's `responseHook`,
290290
// we capture them here just to be safe. Double captures are deduplicated by the SDK.
291-
captureException(e, scope => markEventUnhandled(scope, 'auto.function.aws-serverless.handler'));
291+
captureException(e, scope => markEventUnhandled(scope, 'auto.function.aws_serverless.handler'));
292292
throw e;
293293
} finally {
294294
if (timeoutWarningTimer) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ describe('AWSLambda', () => {
533533
// @ts-expect-error just mocking around...
534534
expect(evtProcessor!(event).exception.values[0]?.mechanism).toEqual({
535535
handled: false,
536-
type: 'auto.function.aws-serverless.handler',
536+
type: 'auto.function.aws_serverless.handler',
537537
});
538538
}
539539
});
@@ -576,7 +576,7 @@ describe('AWSLambda', () => {
576576
// @ts-expect-error just mocking around...
577577
expect(evtProcessor(event).exception.values[0]?.mechanism).toEqual({
578578
handled: false,
579-
type: 'auto.function.aws-serverless.handler',
579+
type: 'auto.function.aws_serverless.handler',
580580
});
581581
}
582582
});

0 commit comments

Comments
 (0)