Skip to content

Conversation

@wangzlei
Copy link
Contributor

@wangzlei wangzlei commented Oct 28, 2024

Issue #, if available:

In OpenTelemetry Python contrib, datadog set the Lambda handler span kind to be CONSUMER if the Lambda invocation is triggered by SNS/SQS/DDB, but actually that logic should be applied to Lambda Service span. The Lambda handler span should be always SERVER since it is triggered by Lambda Service.

Description of changes:
Update the span kind of Lambda handler span to be SERVER from ADOT SDK repo.

After this change, the Lambda handler segment name looks normal

{
            "Id": "5da4657e70beac54",
            "Document": {
                "id": "5da4657e70beac54",
                "name": "snsSubscriber",
                "start_time": 1730158477.6370573,
                "trace_id": "1-67201f8d-4cf059993c2b913f2127f7da",
                "end_time": 1730158478.2419734,
                "parent_id": "b00ba984da7fd16f",
                "aws": {
                    "span.kind": "LOCAL_ROOT",
                    "log.group.names": "/aws/lambda/snsSubscriber"
                },
                "annotations": {
                    "aws.local.service": "snsSubscriber",
                    "span.name": "lambda_function.lambda_handler",
                    "aws.local.operation": "snsSubscriber/FunctionHandler",
                    "span.kind": "SERVER",
                    "aws.local.environment": "lambda:default"
                },
                "metadata": {
                    "cloud.region": "us-west-1",
                    "service.name": "snsSubscriber",
                    "faas.name": "snsSubscriber",
                    "telemetry.sdk.name": "opentelemetry",
                    "aws.span.kind": "LOCAL_ROOT",
                    "telemetry.sdk.language": "python",
                    "cloud.provider": "aws",
                    "faas.invocation_id": "c8aff945-7d0a-472a-9785-97763944efbf",
                    "cloud.account.id": "816069141447",
                    "cloud.resource_id": "arn:aws:lambda:us-west-1:816069141447:function:snsSubscriber",
                    "faas.instance": "2024/10/28/[$LATEST]88c0a736ba8d42bab162aa3a25180f73",
                    "aws.log.group.names": "/aws/lambda/snsSubscriber",
                    "telemetry.sdk.version": "1.27.0",
                    "faas.version": "$LATEST",
                    "PlatformType": "AWS::Lambda",
                    "telemetry.auto.version": "0.6.0.dev0-aws"
                },

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@wangzlei wangzlei requested a review from a team as a code owner October 28, 2024 23:18
mxiamxia
mxiamxia previously approved these changes Oct 28, 2024
@mxiamxia mxiamxia self-requested a review October 28, 2024 23:26
mxiamxia
mxiamxia previously approved these changes Oct 28, 2024
@mxiamxia mxiamxia merged commit 13fb4dc into aws-observability:main Oct 29, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants