-
Notifications
You must be signed in to change notification settings - Fork 1k
Convert aws sdk 2.2 Sqs Suppress Receive Spans Tests #12895
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
17d9ec9
start converting
jaydeluca 883a163
converted tests green
jaydeluca 33a0d15
refactoring
jaydeluca 58b7f0c
refactoring
jaydeluca 01f1721
fix checkstyle
jaydeluca 13ff8a0
fix message id assertions
jaydeluca 4399b81
cleanup
jaydeluca 3a2201f
fix
jaydeluca b35e774
use primitive boolean
jaydeluca b6f8661
field declarations before methods
jaydeluca ed9128a
fix overload grouping
jaydeluca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 0 additions & 27 deletions
27
...tion/aws-sdk/aws-sdk-2.2/javaagent/src/test/groovy/Aws2SqsSuppressReceiveSpansTest.groovy
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
.../opentelemetry/javaagent/instrumentation/awssdk/v2_2/Aws2SqsSuppressReceiveSpansTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.javaagent.instrumentation.awssdk.v2_2; | ||
|
|
||
| import io.opentelemetry.instrumentation.awssdk.v2_2.AbstractAws2SqsSuppressReceiveSpansTest; | ||
| import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; | ||
| import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; | ||
| import org.junit.jupiter.api.extension.RegisterExtension; | ||
| import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; | ||
| import software.amazon.awssdk.services.sqs.SqsAsyncClient; | ||
| import software.amazon.awssdk.services.sqs.SqsClient; | ||
|
|
||
| class Aws2SqsSuppressReceiveSpansTest extends AbstractAws2SqsSuppressReceiveSpansTest { | ||
|
|
||
| @RegisterExtension | ||
| static final InstrumentationExtension testing = AgentInstrumentationExtension.create(); | ||
|
|
||
| @Override | ||
| protected InstrumentationExtension getTesting() { | ||
| return testing; | ||
| } | ||
|
|
||
| @Override | ||
| protected SqsClient configureSqsClient(SqsClient sqsClient) { | ||
| return sqsClient; | ||
| } | ||
|
|
||
| @Override | ||
| protected SqsAsyncClient configureSqsClient(SqsAsyncClient sqsClient) { | ||
| return sqsClient; | ||
| } | ||
|
|
||
| @Override | ||
| protected ClientOverrideConfiguration.Builder createOverrideConfigurationBuilder() { | ||
| return ClientOverrideConfiguration.builder(); | ||
| } | ||
| } |
109 changes: 0 additions & 109 deletions
109
...roovy/io/opentelemetry/instrumentation/awssdk/v2_2/Aws2SqsSuppressReceiveSpansTest.groovy
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...lemetry/instrumentation/awssdk/v2_2/Aws2SqsSuppressReceiveSpansDefaultPropagatorTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.awssdk.v2_2; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import java.net.URISyntaxException; | ||
| import org.junit.jupiter.api.Test; | ||
| import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; | ||
| import software.amazon.awssdk.services.sqs.SqsClient; | ||
| import software.amazon.awssdk.services.sqs.SqsClientBuilder; | ||
| import software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse; | ||
|
|
||
| class Aws2SqsSuppressReceiveSpansDefaultPropagatorTest extends Aws2SqsSuppressReceiveSpansTest { | ||
|
|
||
| @Override | ||
| protected void configure(AwsSdkTelemetryBuilder telemetryBuilder) {} | ||
|
|
||
| @Override | ||
| protected boolean isSqsAttributeInjectionEnabled() { | ||
| return false; | ||
| } | ||
|
|
||
| @Test | ||
| void testDuplicateTracingInterceptor() throws URISyntaxException { | ||
| SqsClientBuilder builder = SqsClient.builder(); | ||
| configureSdkClient(builder); | ||
| ClientOverrideConfiguration overrideConfiguration = | ||
| ClientOverrideConfiguration.builder() | ||
| .addExecutionInterceptor(telemetry.newExecutionInterceptor()) | ||
| .addExecutionInterceptor(telemetry.newExecutionInterceptor()) | ||
| .build(); | ||
| builder.overrideConfiguration(overrideConfiguration); | ||
| SqsClient client = configureSqsClient(builder.build()); | ||
|
|
||
| client.createQueue(createQueueRequest); | ||
| client.sendMessage(sendMessageRequest); | ||
| ReceiveMessageResponse response = client.receiveMessage(receiveMessageRequest); | ||
|
|
||
| assertThat(response.messages().size()).isEqualTo(1); | ||
| response.messages().forEach(message -> getTesting().runWithSpan("process child", () -> {})); | ||
|
|
||
| assertSqsTraces(false, false); | ||
| } | ||
| } |
54 changes: 54 additions & 0 deletions
54
...st/java/io/opentelemetry/instrumentation/awssdk/v2_2/Aws2SqsSuppressReceiveSpansTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.awssdk.v2_2; | ||
|
|
||
| import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; | ||
| import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.extension.RegisterExtension; | ||
| import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; | ||
| import software.amazon.awssdk.services.sqs.SqsAsyncClient; | ||
| import software.amazon.awssdk.services.sqs.SqsClient; | ||
|
|
||
| public abstract class Aws2SqsSuppressReceiveSpansTest | ||
| extends AbstractAws2SqsSuppressReceiveSpansTest { | ||
| @RegisterExtension | ||
| static final InstrumentationExtension testing = LibraryInstrumentationExtension.create(); | ||
|
|
||
| @BeforeEach | ||
| void setup() { | ||
| AwsSdkTelemetryBuilder telemetryBuilder = | ||
| AwsSdkTelemetry.builder(getTesting().getOpenTelemetry()) | ||
| .setCaptureExperimentalSpanAttributes(true); | ||
| configure(telemetryBuilder); | ||
| telemetry = telemetryBuilder.build(); | ||
| } | ||
|
|
||
| @Override | ||
| protected InstrumentationExtension getTesting() { | ||
| return testing; | ||
| } | ||
|
|
||
| protected abstract void configure(AwsSdkTelemetryBuilder telemetryBuilder); | ||
|
|
||
| protected AwsSdkTelemetry telemetry; | ||
|
|
||
| @Override | ||
| protected ClientOverrideConfiguration.Builder createOverrideConfigurationBuilder() { | ||
| return ClientOverrideConfiguration.builder() | ||
| .addExecutionInterceptor(telemetry.newExecutionInterceptor()); | ||
| } | ||
|
|
||
| @Override | ||
| protected SqsClient configureSqsClient(SqsClient sqsClient) { | ||
| return telemetry.wrap(sqsClient); | ||
| } | ||
|
|
||
| @Override | ||
| protected SqsAsyncClient configureSqsClient(SqsAsyncClient sqsClient) { | ||
| return telemetry.wrap(sqsClient); | ||
| } | ||
| } | ||
25 changes: 25 additions & 0 deletions
25
...umentation/awssdk/v2_2/Aws2SqsSuppressReceiveSpansW3cPropagatorAndXrayPropagatorTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.awssdk.v2_2; | ||
|
|
||
| /** | ||
| * We want to test the combination of W3C + Xray, as that's what you'll get in prod if you enable | ||
| * W3C. | ||
| */ | ||
| class Aws2SqsSuppressReceiveSpansW3cPropagatorAndXrayPropagatorTest | ||
| extends Aws2SqsSuppressReceiveSpansTest { | ||
|
|
||
| @Override | ||
| protected void configure(AwsSdkTelemetryBuilder telemetryBuilder) { | ||
| telemetryBuilder.setUseConfiguredPropagatorForMessaging( | ||
| isSqsAttributeInjectionEnabled()); // Difference to main test | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean isSqsAttributeInjectionEnabled() { | ||
| return true; | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
27
...entelemetry/instrumentation/awssdk/v2_2/Aws2SqsSuppressReceiveSpansW3cPropagatorTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.awssdk.v2_2; | ||
|
|
||
| class Aws2SqsSuppressReceiveSpansW3cPropagatorTest extends Aws2SqsSuppressReceiveSpansTest { | ||
| @Override | ||
| protected void configure(AwsSdkTelemetryBuilder telemetryBuilder) { | ||
| telemetryBuilder | ||
| .setUseConfiguredPropagatorForMessaging( | ||
| isSqsAttributeInjectionEnabled()) // Difference to main test | ||
| .setUseXrayPropagator( | ||
| isXrayInjectionEnabled()); // Disable to confirm messaging propagator actually works | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean isSqsAttributeInjectionEnabled() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean isXrayInjectionEnabled() { | ||
| return false; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.