You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
API Gateway (HTTP API v2)
Handler: ApiGatewayProxyHandlerV2
Event: ApiGatewayProxyEventV2
faas.trigger ➜ http
EventBridge Scheduler (or Rules)
Handler: ScheduledHandler
Event: ScheduledEvent
faas.trigger ➜ timer
SQS
Handler: SQSHandler
Event: SQSEvent
faas.trigger ➜ pubsub
messaging.system ➜ aws_sqs
messaging.operation ➜ process
S3
Handler: S3Handler
Event: S3Event
faas.trigger ➜ datasource
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.
The text was updated successfully, but these errors were encountered:
TypeScript often rely on the @types/aws-lambda module to define the handler type or event source triggering the function.
By inspecting the handler or event type, the instrumentation can infer the faas.trigger attribute and enrich telemetry data accordingly.
The @types/aws-lambda package is a DefinitelyTyped package, it only provides types/interfaces to help with development in your IDE. The actual generated JS code cannot change logic based on such types from TypeScript.
This is one of the reasons why this related PR (#2404) adds attributes for APIGW events based on what exactly is in an event, rather than checking the TypeScript types/interfaces of the handler/event (not possible).
I suppose the proposal needs to be modified so that each event source is differentiated based on the values in the event.
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)
ApiGatewayProxyHandler
ApiGatewayProxyEvent
faas.trigger
➜http
API Gateway (HTTP API v2)
ApiGatewayProxyHandlerV2
ApiGatewayProxyEventV2
faas.trigger
➜http
EventBridge Scheduler (or Rules)
ScheduledHandler
ScheduledEvent
faas.trigger
➜timer
SQS
SQSHandler
SQSEvent
faas.trigger
➜pubsub
messaging.system
➜aws_sqs
messaging.operation
➜process
S3
S3Handler
S3Event
faas.trigger
➜datasource
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.
The text was updated successfully, but these errors were encountered: