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

Add E2E tests for AWS XRay Exporter with and without XRay ID Generator #1474

Conversation

jj22ee
Copy link
Contributor

@jj22ee jj22ee commented Oct 27, 2023

Description:

https://aws.amazon.com/about-aws/whats-new/2023/10/aws-x-ray-w3c-format-trace-ids-distributed-tracing/

AWS X-Ray now supports W3C trace IDs generated via OpenTelemetry and other frameworks that conform to the W3C Trace Context specification

This new feature support by X-Ray means that there should no more need for OTel SDKs to be configured with the XRay ID Generator when using the AWS XRay Exporter. This PR will add E2E tests to validate sending and retrieving traces that are:

  • generated by OTel SDK with and without the XRay ID Generator
  • sent from ADOT Collector + XRay Exporter
  • received by XRay

Link to tracking Issue:

Testing:
Tested locally and in forked aws-otel-collector repository with a modified workflow.

Documentation:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jj22ee jj22ee requested a review from a team as a code owner October 27, 2023 22:16
@jj22ee
Copy link
Contributor Author

jj22ee commented Oct 27, 2023

Should rename job run-logs-testbed to run-adot-testbed in CI workflow in aws-observability/aws-otel-collector after this PR.

Copy link
Contributor

@wangzlei wangzlei left a comment

Choose a reason for hiding this comment

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

LGTM


@Testcontainers(disabledWithoutDocker = true)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TraceIdsWithXRayTests {
Copy link
Member

Choose a reason for hiding this comment

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

In the spirit of leaving things better than what you found, could you create a base class that has most of the logic for initializing the collector?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved all container initialization to base class.


@Test
void testXRayTraceIdSendToXRay() throws Exception {
List<String> traceIds = createTraces(true);
Copy link
Member

Choose a reason for hiding this comment

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

boolean flags for behaviour is a code smell. You could make the trace id generator a static property of this test class and then pass it as parameter to each method. It is more explicit than true and false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed

@@ -27,6 +27,16 @@ dependencies {
testImplementation("com.github.rholder:guava-retrying:2.0.0")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.13.0")

// Trace ID (W3C & XRay) tests with XRay Exporter
api(platform("io.opentelemetry:opentelemetry-bom:1.30.0"))
Copy link
Member

Choose a reason for hiding this comment

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

if you use the alpha bom, you don't need to specify the version in any of the opentelemetry dependencies with gid io.opentelemetry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to alpha bom

}

// Takes a few seconds for traces to appear in XRay
Thread.sleep(20000);
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added retry

@jj22ee jj22ee force-pushed the trace-id-value-xray-exporter-tests branch from dc5b4a8 to e4f50aa Compare December 5, 2023 20:51
@jj22ee jj22ee requested a review from rapphil December 5, 2023 22:52
Copy link
Member

@rapphil rapphil 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 LGTM and is increasing the coverage of the testbed, which is good.

I would like to just request that this is not merged before ADOT collector v0.36.0 is released. Also I would like to request a follow up pr on the collector repo to change the name of this workflow and perform any other required changes. https://github.com/aws-observability/aws-otel-collector/blob/main/.github/workflows/CI.yml#L711

@bryan-aguilar bryan-aguilar merged commit 7c31e88 into aws-observability:terraform Dec 18, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants