Skip to content

Commit

Permalink
fix(aws-serverless): Add op to Otel-generated lambda function root …
Browse files Browse the repository at this point in the history
…span (#12430)

Add the `sentry.op` attribute/`op` property to the created root
span/transaction of a lambda function.
  • Loading branch information
Lms24 authored Jun 10, 2024
1 parent a238fff commit fee7f68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ test('Lambda layer SDK bundle sends events', async ({ request }) => {
'sentry.sample_rate': 1,
'sentry.source': 'custom',
'sentry.origin': 'auto.otel.aws-lambda',
'sentry.op': 'function.aws.lambda',
'cloud.account.id': '123453789012',
'faas.id': 'arn:aws:lambda:us-east-1:123453789012:function:my-lambda',
'otel.kind': 'SERVER',
},
op: 'function.aws.lambda',
origin: 'auto.otel.aws-lambda',
span_id: expect.any(String),
status: 'ok',
Expand Down
3 changes: 2 additions & 1 deletion packages/aws-serverless/src/integration/awslambda.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AwsLambdaInstrumentation } from '@opentelemetry/instrumentation-aws-lambda';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration } from '@sentry/core';
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration } from '@sentry/core';
import { addOpenTelemetryInstrumentation } from '@sentry/node';
import type { IntegrationFn } from '@sentry/types';

Expand All @@ -11,6 +11,7 @@ const _awsLambdaIntegration = (() => {
new AwsLambdaInstrumentation({
requestHook(span) {
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.otel.aws-lambda');
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'function.aws.lambda');
},
}),
);
Expand Down

0 comments on commit fee7f68

Please sign in to comment.