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 instrumentation for spring-cloud-aws SqsListener annotation #12314

Merged
merged 6 commits into from
Oct 7, 2024

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Sep 23, 2024

Resolves #12267
Resolves #4788
Hopefully also resolves #9575

* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public final class AwsSdkInstrumenterFactory {
Copy link
Contributor

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.

This class is used by AwsSdkTelemetry that is in a different package. This comment is enforced by tooling on public classes in internal package. It is not needed on SqsAdviceBridge as it is not in internal package.

@Override
public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(
named("onMessage").and(takesArgument(0, named("org.springframework.messaging.Message"))),
Copy link
Contributor

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 a TODO. I skipped it because I wasn't quite sure how to handle it.


@BeforeAll
static void setUp() {
sqs = SQSRestServerBuilder.withPort(0).withInterface("localhost").start();
Copy link
Member

Choose a reason for hiding this comment

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

any concern about port conflicts here?

Suggested change
sqs = SQSRestServerBuilder.withPort(0).withInterface("localhost").start();
int sqsPort = PortUtils.findOpenPort();
sqs = SQSRestServerBuilder.withPort(sqsPort).withInterface("localhost").start();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Port 0 usually means any port, os will pick whatever port is free. This is really the best option. The algorithm in PortUtils.findOpenPort mostly attempts to guard that tests running in parallel wouldn't try to use the same port, it is not able guarantee that some other application won't use the port it has picked.

@laurit laurit merged commit 9a7f712 into open-telemetry:main Oct 7, 2024
56 checks passed
@laurit laurit deleted the spring-cloud-aws branch October 7, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants