What I want:
To have one AWS X-Ray trace from the integration that calls my ion-lambda (i.e. SNS), through to my fn
that is bound to that lambda, through to the downstream systems.
From my fn
down this is a solved problem (thanks to GitHub - steffan-westcott/clj-otel: An idiomatic Clojure API for adding telemetry to your libraries and applications using OpenTelemetry.)
I need the ion-lambda, to propagate the X-Ray trace-id
. This is where I am stuck.
What I have done:
- Enabled Active tracing for the bound ion-lambda: Using AWS Lambda with AWS X-Ray - AWS Lambda
What I then realised:
- In my
fn
, I do not have access to the X-Ray trace-id, it is not in the:context
- I need that, to use as a parent-id for OpenTelemetry
It seems that trace-id is not available in the lambda context. It is only available in the _X_AMZN_TRACE_ID
environment variable, while the lambda is running: Using AWS Lambda environment variables - AWS Lambda
What I then need:
- For Cognitect to send along those environment variables. Or at least
_X_AMZN_TRACE_ID
It is always a little bit trickier with AWS than it needs to be!