Skip to content

Commit fee7f68

Browse files
authored
fix(aws-serverless): Add op to Otel-generated lambda function root span (#12430)
Add the `sentry.op` attribute/`op` property to the created root span/transaction of a lambda function.
1 parent a238fff commit fee7f68

File tree

2 files changed

+4
-1
lines changed
  • dev-packages/e2e-tests/test-applications/aws-lambda-layer-cjs/tests
  • packages/aws-serverless/src/integration

2 files changed

+4
-1
lines changed

dev-packages/e2e-tests/test-applications/aws-lambda-layer-cjs/tests/basic.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ test('Lambda layer SDK bundle sends events', async ({ request }) => {
3030
'sentry.sample_rate': 1,
3131
'sentry.source': 'custom',
3232
'sentry.origin': 'auto.otel.aws-lambda',
33+
'sentry.op': 'function.aws.lambda',
3334
'cloud.account.id': '123453789012',
3435
'faas.id': 'arn:aws:lambda:us-east-1:123453789012:function:my-lambda',
3536
'otel.kind': 'SERVER',
3637
},
38+
op: 'function.aws.lambda',
3739
origin: 'auto.otel.aws-lambda',
3840
span_id: expect.any(String),
3941
status: 'ok',

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AwsLambdaInstrumentation } from '@opentelemetry/instrumentation-aws-lambda';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration } from '@sentry/core';
2+
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration } from '@sentry/core';
33
import { addOpenTelemetryInstrumentation } from '@sentry/node';
44
import type { IntegrationFn } from '@sentry/types';
55

@@ -11,6 +11,7 @@ const _awsLambdaIntegration = (() => {
1111
new AwsLambdaInstrumentation({
1212
requestHook(span) {
1313
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.otel.aws-lambda');
14+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'function.aws.lambda');
1415
},
1516
}),
1617
);

0 commit comments

Comments
 (0)