-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read _X_AMZN_TRACE_ID from system properties if environment variable is not set #251
Comments
…ronment variable is not set
* Issue: #251 - Read _X_AMZN_TRACE_ID from system properties if environment variable is not set * Update aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/contexts/LambdaSegmentContext.java Co-authored-by: William Armiros <[email protected]>
aws-xray renamed _X_AMZN_TRACE_ID environment property to System Property com.amazonaws.xray.traceHeader aws/aws-xray-sdk-java#251
aws-xray renamed _X_AMZN_TRACE_ID environment property to System Property com.amazonaws.xray.traceHeader aws/aws-xray-sdk-java#251
@willarmiros Do you maybe know when this feature is gonna be published? |
Probably you can use the latest snapshot (https://aws.oss.sonatype.org/content/repositories/snapshots/) to consume this enhancement and that will unblock you temporararily while waiting for the actual release. We publish snapshot on every merge to |
is this issue still relevant? has reading from system props logic landed any release? |
Using a custom Lambda runtime, you are required to set the _X_AMZN_TRACE_ID environment variable on each request.
In Java there is no easy way of setting environment variables at runtime, this StackOverflow post details some of the hacks and edge cases you need to work around to get this to work.
The Lambda custom runtime documentation clearly says this should be an environment variable, but would it be possible to create a fallback for the Java SDK, where in case the environment variable is not set, it will check the system properties?
The relevant SDK code is line 40 in LambdaSegmentContext.
Having system properties as a fallback would still compatible with the documentation and any implementation using environment variables, but future Java implementations would not need to circumvent the environment variables system in Java.
The text was updated successfully, but these errors were encountered: