Commit 13fb4dc
authored
customize aws lambda instrumentation to span kind always be SERVER (#286)
*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.1 parent 7bf7202 commit 13fb4dc
File tree
5 files changed
+492
-1
lines changed- lambda-layer/src
- opentelemetry/instrumentation/aws_lambda
5 files changed
+492
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
0 commit comments