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

Automatic AWS library instrumentor #4607

Merged
merged 1 commit into from
Nov 22, 2021

Conversation

steven-aerts
Copy link
Contributor

Like AWS X-Ray, provide an instrumentor which automatically registers
opentelemetry instrumentation in the AWS SDK without any code changes.
Those instrumentors are separate libraries published as
opentelemetry-aws-sdk-1.11-instrumentor and opentelemetry-aws-sdk-2.2-instrumentor

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 8, 2021

CLA Signed

The committers are authorized under a signed CLA.

@steven-aerts steven-aerts force-pushed the aws-sdk-instrumentor branch 2 times, most recently from 16bee72 to a9e8363 Compare November 8, 2021 09:49
Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Thanks @steven-aerts! Sorry for the huge delay on reviewing

Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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


private final OpenTelemetry openTelemetry;

private boolean captureExperimentalSpanAttributes;

AwsSdkTracingBuilder(OpenTelemetry openTelemetry) {
this.openTelemetry = openTelemetry;
this.captureExperimentalSpanAttributes = CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES_DEFAULT;
Copy link
Member

@trask trask Nov 17, 2021

Choose a reason for hiding this comment

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

other library instrumentations only allow programmatic configuration of captureExperimentalSpanAttributes, I'd suggest doing the same here for consistency (setting this from the autoconfigure module), and opening an issue to discuss doing this across all library instrumentations if there's interest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @trask ,

The captureExperimentalSpanAttributes could already be configured by these system properties/environment variables. I only moved this mechanism to make sure this can be shared between the java-agent and the autoconfigure library.
I understand that the default for the builder are now also changing based on these variables.
Would it be a solution if I add an extra method to the AwsSdkTracingBuilder, which is then called by both the java-agent as the autoconfigure class?
Or do you prefer the PR where I copy this behaviour to all other classes which have these Config variables for the java-agent?

Copy link
Member

Choose a reason for hiding this comment

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

Would it be a solution if I add an extra method to the AwsSdkTracingBuilder, which is then called by both the java-agent as the autoconfigure class?

AwsSdkTracingBuilder already has setCaptureExperimentalSpanAttributes, can you call this from both javaagent and autoconfigure modules? I think that would be most consistent with other instrumentations currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@trask I tried to update it, while still keeping the Config parameter in one place for v1.1.
Let me know what you think.

Comment on lines 47 to 51
public static AwsSdkTracing fromAgentConfig(OpenTelemetry openTelemetry) {
return builder(openTelemetry)
.setCaptureExperimentalSpanAttributes(CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES_DEFAULT)
.build();
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want to expose "agent" methods in library instrumentation, can the agent call setCaptureExperimentalSpanAttributes directly instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@trask I inlined the function on the two places where it is used.
This currently means that also Config.get().getBoolean("otel.instrumentation.aws-sdk.experimental-span-attributes", false)) is duplicated.
Let me know if you prefer this to be put in a constant on the AwsSdkTracing class or its builder.

Copy link
Member

Choose a reason for hiding this comment

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

thx! we have some related work to do (and will likely end up where you were going originally with adding Config default directly to library instrumentation) but appreciate keeping it consistent with existing instrumentation for now 👍

Like AWS X-Ray, provide an instrumentor which automatically registers
opentelemetry instrumentation in the AWS SDK without any code changes.
Those instrumentors are separate libraries published as
opentelemetry-aws-sdk-1.11-instrumentor and opentelemetry-aws-sdk-2.2-instrumentor
@trask trask merged commit e014227 into open-telemetry:main Nov 22, 2021
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
Like AWS X-Ray, provide an instrumentor which automatically registers
opentelemetry instrumentation in the AWS SDK without any code changes.
Those instrumentors are separate libraries published as
opentelemetry-aws-sdk-1.11-instrumentor and opentelemetry-aws-sdk-2.2-instrumentor
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.

None yet

3 participants