-
Notifications
You must be signed in to change notification settings - Fork 46
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
Added opentracing-jdbc #332
Conversation
c1381cf
to
f587563
Compare
...cing-jdbc/src/main/java/org/zalando/opentracing/jdbc/span/DatabaseInstanceSpanDecorator.java
Outdated
Show resolved
Hide resolved
...entracing-jdbc/src/main/java/org/zalando/opentracing/jdbc/TracingQueryExecutionListener.java
Show resolved
Hide resolved
final Statement statement = info.getStatement(); | ||
final Throwable error = info.getThrowable(); | ||
|
||
decorator.onError(span, statement, error); |
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.
Is it an issue that in case the decorator fails (i.e. exception thrown in onError
) that we never gonna call span.finish()
?
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.
True. Good catch.
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.
Now I'm curious how vendors/implementations deal with that. Technically it could be the source of a memory leak to start but never finish spans. Ideally tracers would keep only weak references to spans and discard them.
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 added a try-finally
around onError
but technically the onQuery
could fail also and what to do with the span then? Discard (if, how)? Ignore and finish as usual?
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.
If I'm reading LightStep's code correctly then they don't keep a strong reference to it and abandoned spans would be garbage collected.
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.
Question regarding errors during onQuery
still stands though.
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.
If onQuery
fails, is afterQuery
(and hence onError
) called?
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.
beforeQuery
is running outside the try-finally
that would execute the afterQuery
.
...opentracing-jdbc/src/main/java/org/zalando/opentracing/jdbc/span/ComponentSpanDecorator.java
Show resolved
Hide resolved
...jdbc/opentracing-jdbc/src/main/java/org/zalando/opentracing/jdbc/span/PatternPeerParser.java
Show resolved
Hide resolved
...jdbc/opentracing-jdbc/src/main/java/org/zalando/opentracing/jdbc/span/PeerSpanDecorator.java
Outdated
Show resolved
Hide resolved
5e78219
to
8070e93
Compare
opentracing-jdbc/opentracing-jdbc/src/test/java/org/zalando/opentracing/jdbc/Matrix.java
Show resolved
Hide resolved
251b654
to
d28f7cf
Compare
👍 |
I have to double check but if my memory is correct then no.
…On Tue, 26 Nov 2019, 22:17 lukasniemeier-zalando, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
opentracing-jdbc/opentracing-jdbc/src/main/java/org/zalando/opentracing/jdbc/TracingQueryExecutionListener.java
<#332 (comment)>
:
> +
+ decorator.onQuery(span, statement, queries);
+
+ info.addCustomValue(SPAN, span);
+ }
+
+ @OverRide
+ @SneakyThrows(SQLException.class)
+ public void afterQuery(final ExecutionInfo info, final List<QueryInfo> queries) {
+ final Span span = info.getCustomValue(SPAN, Span.class);
+
+ if (!info.isSuccess()) {
+ final Statement statement = info.getStatement();
+ final Throwable error = info.getThrowable();
+
+ decorator.onError(span, statement, error);
If onQuery fails, is afterQuery (and hence onError) called?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#332?email_source=notifications&email_token=AADI7HKRWV5DX7C3ORCPT7TQVWHAHA5CNFSM4JRPHNP2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCNCQKCI#discussion_r350984404>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADI7HIDCPMHWVQXMZJDTWTQVWHAHANCNFSM4JRPHNPQ>
.
|
d13de35
to
4987d88
Compare
👍 |
Description
Motivation and Context
Part of #328
Types of changes
Checklist: