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

Instrumentation version on application tracer not set correctly when using agent #4628

Closed
steffan-westcott opened this issue Nov 10, 2021 · 0 comments · Fixed by #4630
Closed
Labels
bug Something isn't working

Comments

@steffan-westcott
Copy link

steffan-westcott commented Nov 10, 2021

Describe the bug
When an application using the Java agent creates a tracer, the instrumentation version is incorrectly set as the schema URL instead. Browsing the source code for the Java agent, it appears there is a copy'n'paste bug on this line
It appears

agentTracerBuilder.setSchemaUrl(s);

should instead be

agentTracerBuilder.setInstrumentationVersion(s);

Steps to reproduce
Using code similar to the following for an application run with the Java agent results in spans created by the application to have incorrect instrumentation library attributes:

OpenTelemetry openTelemetry = GlobalOpenTelemetry.get();
TracerBuilder tracerBuilder = openTelemetry.tracerBuilder("my-library");
tracerBuilder.setInstrumentationVersion("1.0.0");
Tracer tracer = tracerBuilder.build();

What did you expect to see?
I expected to see spans (in Jaeger) created by the application to have the tag otel.library.name with value my-library and tag otel.library.version with value 1.0.0

What did you see instead?
I see spans created by the application with tag otel.library.name as expected, but no tag otel.library.version.
On further investigation using a Java debugger, I see that fields for a SdkTracerBuilder instance are incorrectly set, where field instrumentationVersion is null and schemaUrl is 1.0.0.
Note that spans created by the agent are fine, they have expected values for tags otel.library.name and otel.library.version.

What version are you using?
Java agent version 1.7.2

Environment
Compiler: openjdk version "11.0.11" 2021-04-20
OS: Ubuntu 20.04
Runtime (if different from JDK above): OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OS (if different from OS compiled on): Windows 10, running WSL 2

Additional context
My application is actually written in Clojure, so I've had to simplify some of the details above. Apologies in advance if my Java syntax is a little off!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant