Description
Summary
Developers authoring AWS Lambda functions in TypeScript often rely on the @types/aws-lambda module to define the handler type or event source triggering the function. This information could serve as a valuable hint to automatically set the faas.trigger
attribute and other related attributes in OpenTelemetry.
Proposal
By inspecting the handler or event type, the instrumentation can infer the faas.trigger
attribute and enrich telemetry data accordingly.
Examples
-
API Gateway (REST)
- Handler:
ApiGatewayProxyHandler
- Event:
ApiGatewayProxyEvent
faas.trigger
➜http
- Handler:
-
API Gateway (HTTP API v2)
- Handler:
ApiGatewayProxyHandlerV2
- Event:
ApiGatewayProxyEventV2
faas.trigger
➜http
- Handler:
-
EventBridge Scheduler (or Rules)
- Handler:
ScheduledHandler
- Event:
ScheduledEvent
faas.trigger
➜timer
- Handler:
-
SQS
- Handler:
SQSHandler
- Event:
SQSEvent
faas.trigger
➜pubsub
messaging.system
➜aws_sqs
messaging.operation
➜process
- Handler:
-
S3
- Handler:
S3Handler
- Event:
S3Event
faas.trigger
➜datasource
- Handler:
Additional S3 Context
If the event includes an S3EventRecord
, additional attributes could be derived:
faas.document.collection
➜ Bucket Name (e.g.,myBucketName
)faas.document.operation
➜ Operation Type (e.g.,insert
)faas.document.name
➜ File Name (e.g.,myFile.txt
)faas.document.time
➜ Event Time (e.g.,2020-01-23T13:47:06Z
)
Benefits
Automatically setting these attributes improves traceability and observability, reducing the burden on developers to manually add this information while adhering to OpenTelemetry semantic conventions.