Skip to content
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

ParentContextExtractor should read tracing info from system property #7579

Closed
smirnoal opened this issue Jan 15, 2023 · 7 comments
Closed

ParentContextExtractor should read tracing info from system property #7579

smirnoal opened this issue Jan 15, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@smirnoal
Copy link

Is your feature request related to a problem? Please describe.
Java does not have a good mechanism for modifying environment variables. There are some hacky solutions which use Reflection API, and modify the UnmodifiableMap which holds the variables. This technique is now discouraged by Oracle. Good reads on this topic: blog post by Oracle

Because of this, setting tracing information via _X_AMZN_TRACE_ID is challenging in new versions of Java, even with the hack.

Would it be possible to implement reading tracing information from a system property, not from an environment variable? aws-x-ray-sdk-java implemented this some time ago: link

Describe the solution you'd like
Optionally read tracing information from com.amazonaws.xray.traceHeader system property.
Similarly to this PR: https://github.com/aws/aws-xray-sdk-java/pull/252/files

Additional context
Perhaps, this class should be modified: link

@trask
Copy link
Member

trask commented Apr 2, 2023

Would it be possible to implement reading tracing information from a system property, not from an environment variable? aws-x-ray-sdk-java implemented this some time ago: link

it looks like that issue is still open?

@smirnoal
Copy link
Author

smirnoal commented Apr 3, 2023

and still actual. Would be great if someone can pick it up. Looks pretty straightforward to implement

@trask
Copy link
Member

trask commented Apr 3, 2023

copying folks who may have knowledge/thoughts/interest: @willarmiros @tylerbenson @open-telemetry/lambda-extension-approvers

@tylerbenson
Copy link
Member

tylerbenson commented Apr 5, 2023

Note that in #7970, the span context in this env var becomes a span link instead of the parent. I have no objection to reading from both locations for populating the span link.

I think the main question I have is can this be included in the relevant spec somehow? When I updated that section earlier this year, I didn't understand or expect that the environment variable was updated for each request as that's not something normal applications do. I think it's worth adding or linking to some documentation about this environment variable's purpose and odd behavior. I haven't found any docs on it.

@smirnoal is this something you (or someone else at AWS) would be interested in working on?

@smirnoal
Copy link
Author

I believe with the PRs merged, this issue can be closed. Would be good to know which release will contain the fix

@mateuszrzeszutek
Copy link
Member

That will be release 1.27.0, which should happen in ~2 weeks.

@smirnoal
Copy link
Author

smirnoal commented Dec 5, 2023

aws docs were updated: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants