-
Notifications
You must be signed in to change notification settings - Fork 881
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
Next attempt to extract common logic from instrumentations. #523
Conversation
I tried to reduce code repetition in DB client instrumentations, jdbc and mongo ones. This time I experimented with another approach, different from HttpServerTracer. Namely, I have extracted that common `startSpan` method into `DatabaseClientDecorator` itself. The idea is still the same as before, but I wanted to see if we can migrate by smaller steps, reusing much of the existing code and just incrementally reducing public API.
I think it's safer for the Also this would keep the What do you think about the template below for advice that needs to track The template makes sure we always increment/decrement the It also passes It would require adding a few new methods to the The point of
This doesn't solve the problem in this PR of returning
|
First, how does returning Second, it is an open question for me, btw, which instrumentations require this Third, what is the difference between Forth, 😭 for so much copy-paste. Fifth, yeah, that may work :) |
I didn't say it doesn't bother me at all 😂
We can probably reduce the number of places that
Good question, let's make them all
I think it's a good compromise, but let's see how it looks as we start spreading it across various instrumentation, we can always revisit.
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like this, minor suggestions below
agent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/CallDepthThreadLocalMap.java
Show resolved
Hide resolved
...c/main/java/io/opentelemetry/auto/instrumentation/jdbc/PreparedStatementInstrumentation.java
Outdated
Show resolved
Hide resolved
...c/main/java/io/opentelemetry/auto/instrumentation/jdbc/PreparedStatementInstrumentation.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…emetry#523) * Next attempt to extract common logic from instrumentations. I tried to reduce code repetition in DB client instrumentations, jdbc and mongo ones. This time I experimented with another approach, different from HttpServerTracer. Namely, I have extracted that common `startSpan` method into `DatabaseClientDecorator` itself. The idea is still the same as before, but I wanted to see if we can migrate by smaller steps, reusing much of the existing code and just incrementally reducing public API. * Extracted separate Tracer after all * More explicit call depth handling * Fix format * More reusable method overloads
I tried to reduce code repetition in DB client instrumentations, jdbc and mongo ones.
@trask please take a look at
io.opentelemetry.auto.instrumentation.jdbc.JDBCDecorator#startSpan
method. I currently don't see a good way (without repetitive code) to avoid returningnull
from it.