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

Updated Documentation For Change in Behaviour of Reading X-Ray Tracing Info From Lambda #3502

Closed
wants to merge 5 commits into from

Conversation

jdoherty
Copy link

Fixes #

Changes

Related issues #

open-telemetry/opentelemetry-java-instrumentation#8368

Related OTEP(s) #

@jdoherty jdoherty requested review from a team May 12, 2023 13:26
contain an incomplete trace context which indicates X-Ray isn’t enabled. The environment variable will be set and the
There are two common ways to read the tracing information if AWS X-Ray is enabled for a lambda function:

1. Via the system property `com.amazonaws.xray.traceHeader`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is language-independent spec, you need to add more context here on what a "system property" is. I believe this is something specific to the Java runtime?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sure - I have updated this now - is this any better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking to the docs of system properties seems a bit overkill, probably any Java programmer should know them. I think just mentioning that it is Java specific is enough. If linking anything, maybe https://docs.aws.amazon.com/lambda/latest/dg/lambda-java.html

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sure I have removed this now

If the system property `com.amazonaws.xray.traceHeader` is set, instrumentation SHOULD try to parse an OpenTelemetry `Context` out of it using the [AWS X-Ray Propagator](../../../context/api-propagators.md).
Alternatively, if the system property is not set then instrumentation SHOULD try to parse an OpenTelemetry `Context` out of the `_X_AMZN_TRACE_ID` environment variable using the [AWS X-Ray Propagator](../../../context/api-propagators.md).
If the resulting `Context` is [valid](../../api.md#isvalid) then a [Span Link][] SHOULD be added to the new Span's
[start options](../../api.md#specifying-links) with an associated attribute of `source=x-ray-env` to indicate the source of the linked span.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a link attribute should have a proper semantic convention YAML entry (type attribute_group since we don't have a specific type for links yet).

I expect this will also lead to larger discussions, e.g. whether an unprefixed attribute is OK, or which prefix to use, or, since this seems to be a generally useful attribute, whether we want something similar for the span parent.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry Christian - I'm not quite sure what you mean here - can you elaborate on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the spec recommends to set an attribute with a particular name, we always have a corresponding entry in the semantic conventions which are at just this moment moving from this repository to https://github.com/open-telemetry/semantic-conventions.

Adding them there will make many OpenTelemetry languages (semi-)automatically generate string constants with the keys and documentation comments.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok understood - can this be tackled in another PR? This PR is mainly to cover the update to the docs to cover the change made here:

open-telemetry/opentelemetry-java-instrumentation#8368

If the resulting `Context` is [valid](../../api.md#isvalid) then a [Span Link][] SHOULD be added to the new Span's
[start options](../../api.md#specifying-links) with an associated attribute of `source=x-ray-env` to indicate the source of the linked span.
Instrumentation MUST check if the context is valid before using it because the `_X_AMZN_TRACE_ID` environment variable or the system property `com.amazonaws.xray.traceHeader` can
contain an incomplete trace context which indicates X-Ray isn’t enabled. The environment variable or system property will be set and the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems redundant with the next sentence

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sure - I have now removed this

@carlosalberto
Copy link
Contributor

@tylerbenson

Comment on lines 66 to 67
1. Via the system property `com.amazonaws.xray.traceHeader` in the event of a Java function. More information on Java system properties can be found [here](https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html)
2. Via an environment variable that is set, titled `_X_AMZN_TRACE_ID`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ever find documentation for either of these on AWS's side? I think it would be highly beneficial to have a link to more authoritative documentation on what these properties are and how they're used.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working with AWS doc team to get this done

Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR needs to be moved to the https://github.com/open-telemetry/semantic-conventions repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:semantic-conventions Related to semantic conventions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants