aws-otel-lambda
aws-otel-lambda copied to clipboard
faas.coldstart attribute is not being captured by the Lambda layers
Hello team,
I'm doing some testing with AWS Lambda and the OTel Lambda layer. Here is a log generated by the logging exporter.
EXTENSION Name: collector State: Ready Events: [INVOKE,SHUTDOWN]
2022/07/28 17:16:42 [collector] Received event: {
"eventType": "INVOKE",
"deadlineMs": 1659029202511,
"requestId": "a4453547-abc6-4f97-9fc8-4bd874ce9d6b",
"invokedFunctionArn": "arn:aws:lambda:us-east-1:[redacted]:function:otel-sample",
"tracing": {
"type": "X-Amzn-Trace-Id",
"value": "Root=1-62e2c477-06f824e21a7e58fe5ef16c43;Parent=2925122b30b17859;Sampled=1"
}
}
2022/07/28 17:16:42 [collector] Waiting for event...
Hello, world
2022-07-28T17:16:42.583Z INFO loggingexporter/logging_exporter.go:42 TracesExporter {"#spans": 1}
2022-07-28T17:16:42.583Z DEBUG loggingexporter/logging_exporter.go:51 ResourceSpans #0
Resource SchemaURL:
Resource labels:
-> telemetry.sdk.language: STRING(python)
-> telemetry.sdk.name: STRING(opentelemetry)
-> telemetry.sdk.version: STRING(1.11.1)
-> cloud.region: STRING(us-east-1)
-> cloud.provider: STRING(aws)
-> faas.name: STRING(otel-sample)
-> faas.version: STRING($LATEST)
-> service.name: STRING(otel-sample)
-> telemetry.auto.version: STRING(0.30b1)
ScopeSpans #0
ScopeSpans SchemaURL:
InstrumentationScope opentelemetry.instrumentation.aws_lambda 0.30b1
Span #0
Trace ID : 62e2c47706f824e21a7e58fe5ef16c43
Parent ID : c9e8c429e812c43d
ID : cb3315ce306fdd4b
Name : app.lambda_handler
Kind : SPAN_KIND_SERVER
Start time : 2022-07-28 17:16:42.512959436 +0000 UTC
End time : 2022-07-28 17:16:42.513069571 +0000 UTC
Status code : STATUS_CODE_UNSET
Status message :
Attributes:
-> faas.id: STRING(arn:aws:lambda:us-east-1:[redacted]:function:otel-sample)
-> faas.execution: STRING(a4453547-abc6-4f97-9fc8-4bd874ce9d6b)
As you can see, attributes like faas.name, faas.version, faas.id, and faas.execution are captured in my traces. However, I don't see an attribute for cold starts. According to this doc, there is an attribute called faas.coldstart and it is a boolean that is true if the serverless function is executed for the first time. However, this attribute is not shown in my traces when using the Otel Lambda layer. I've tested with the Java layer and the Python layer and neither of them were showing that attribute.