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

Fix JDBC non-supported getUpdateCount #1008

Merged
merged 5 commits into from
Feb 5, 2020

Conversation

eyalkoren
Copy link
Contributor

@eyalkoren eyalkoren commented Jan 26, 2020

Fixes #1006

  • Implement
  • Added tests
  • Add to CHANGELOG

@eyalkoren eyalkoren requested a review from SylvainJuge January 26, 2020 12:15
@eyalkoren eyalkoren self-assigned this Jan 26, 2020
@codecov-io
Copy link

codecov-io commented Jan 26, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@25b949a). Click here to learn what that means.
The diff coverage is 55.61%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1008   +/-   ##
=========================================
  Coverage          ?   62.62%           
  Complexity        ?       85           
=========================================
  Files             ?      271           
  Lines             ?    11010           
  Branches          ?     1463           
=========================================
  Hits              ?     6895           
  Misses            ?     3679           
  Partials          ?      436
Impacted Files Coverage Δ Complexity Δ
...va/co/elastic/apm/agent/impl/ElasticApmTracer.java 70.33% <ø> (ø) 0 <0> (?)
...m/agent/kafka/BaseKafkaHeadersInstrumentation.java 0% <ø> (ø) 0 <0> (?)
.../kafka/ConsumerRecordsIteratorInstrumentation.java 0% <0%> (ø) 0 <0> (?)
...afka/ConsumerRecordsRecordListInstrumentation.java 0% <0%> (ø) 0 <0> (?)
...gent/okhttp/OkHttp3ClientAsyncInstrumentation.java 21.73% <0%> (ø) 0 <0> (?)
.../apm/agent/okhttp/OkHttpClientInstrumentation.java 17.85% <0%> (ø) 0 <0> (?)
...esttemplate/SpringRestTemplateInstrumentation.java 36% <0%> (ø) 0 <0> (?)
.../ApacheHttpAsyncClientRedirectInstrumentation.java 50% <0%> (ø) 0 <0> (?)
...t/opentracing/impl/SpanContextInstrumentation.java 0% <0%> (ø) 0 <0> (?)
...acing/impl/ExternalSpanContextInstrumentation.java 0% <0%> (ø) 0 <0> (?)
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25b949a...21664eb. Read the comment docs.

Copy link
Member

@SylvainJuge SylvainJuge left a comment

Choose a reason for hiding this comment

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

I'm wondering if we could have something simpler in the advice code. Maybe moving the call to getUpdateCount alone in the try/catch would make it a bit more readable, and maybe moving this logic to a dedicated helper class.

Also, it's definitely missing one comment that explain why we do this in this case, maybe a unit test would also help to understand here.

@eyalkoren eyalkoren requested a review from SylvainJuge January 28, 2020 14:11
@@ -232,6 +262,14 @@ private void testPreparedStatement() throws SQLException {
}
}

private void testUpdatePreparedStatement() throws SQLException {
if (updatePreparedStatement != null) {
Copy link
Member

Choose a reason for hiding this comment

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

this should never happen, we can remove the null check here.

Copy link
Member

@SylvainJuge SylvainJuge left a comment

Choose a reason for hiding this comment

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

Looks good to me, only the readme update is missing.

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.

Span isn't closed if JDBC implementation errors on the getUpdateCount method
3 participants