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 names for javaagent vs library instrumentation #1436

Closed
trask opened this issue Oct 21, 2020 · 7 comments · Fixed by #3411
Closed

Instrumentation names for javaagent vs library instrumentation #1436

trask opened this issue Oct 21, 2020 · 7 comments · Fixed by #3411

Comments

@trask
Copy link
Member

trask commented Oct 21, 2020

Should the instrumentation name be the same for both javaagent and library instrumentation?

E.g. io.opentelemetry.grpc

Or should they be different?

E.g. io.opentelemetry.grpc and io.opentelemetry.javaagent.grpc

We have the telemetry.auto.version resource attribute, but that will be applied to library instrumentation when running under the javaagent also, so I don't think we will be able to tell whether spans originated from javaagent instrumentation or library instrumentation in this case.

I'm not sure how important this is to know this difference though (and our goal is to suppress library instrumentation in this case #903).

If we want the instrumentation names to be different, one option would be for the javaagent to pass in named tracers when constructing the library tracers.

@devinsba
Copy link
Contributor

From a code convention point of view, if you were to use the same packages for both then you could use package private classes and methods where classes need to be accessed from the agent. This also has the benefit of decreasing bytecode size

@mateuszrzeszutek
Copy link
Member

mateuszrzeszutek commented Jun 21, 2021

Should we use the following pattern for all our instrumentation names:

io.opentelemetry.{instrumentedLibName}-{instrumentedLibMinVersion}

?

E.g. io.opentelemetry.spring-rabbit-1.0. The version could be omitted for JDK libs, e.g. io.opentelemetry.jdbc

@trask
Copy link
Member Author

trask commented Jun 21, 2021

It would be nice to be able to tell the difference between library and javaagent instrumentation when they are both present (to see which one backed off for example).

@mateuszrzeszutek
Copy link
Member

Won't spans created by javaagent have the telemetry.auto.version resource attribute?

Also, we already have a couple of javaagent instrumentations that simply add the library interceptor/listener, the same way as how library instrumentation is supposed to be used. We don't change their instrumentation names, same value as library instrumentation is passed to the TracerProvider. If we want to distinguish between javaagent and library instrumentations, shouldn't we change that?

@anuraaga
Copy link
Contributor

Yeah I feel as if which code creates the spans is always deterministic - it might be a bit simpler to distinguish them if the names are different but don't think it's worth extra complexity (we can't expose instrumentation name as an option in library instrumentation, so any solution for sharing library instrumentation with javaagent and making the names different seems quite difficult).

@trask
Copy link
Member Author

trask commented Jun 22, 2021

I feel as if which code creates the spans is always deterministic

I'm not clear what you mean, can you clarify?

@trask
Copy link
Member Author

trask commented Jun 23, 2021

@anuraaga @mateuszrzeszutek and I discussed this in meeting yesterday, summary:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants