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

Feat: Add datasource tracing with P6Spy. #1784

Merged
merged 8 commits into from
Oct 28, 2021
Merged

Feat: Add datasource tracing with P6Spy. #1784

merged 8 commits into from
Oct 28, 2021

Conversation

maciejwalkowiak
Copy link
Contributor

@maciejwalkowiak maciejwalkowiak commented Oct 26, 2021

📜 Description

Adds datasource tracing with p6spy.

In comparison to #1095, we do not rely on any 3rd party integration with Spring, we also do not provide any custom integration with Spring. Instead, we use the Java ServiceLoader mechanism to provide an implementation of P6Spy's JdbcEventListener.

As a result, to use P6Spy and Sentry integration with Spring Boot application, it's enough to:

  1. Prefix JDBC url with p6spy, for example:
spring.datasource.url=jdbc:p6spy:hsqldb:mem:testdb
  1. For drivers that do not accept prefixes (like HSQLDB), configure driver-class-name property:
spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver
  1. Add dependency to sentry-p6spy.

💡 Motivation and Context

Missing piece.

💚 How did you test it?

Integration tests and sample app.

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

Depending on the feedback we get, we may also add integration with https://github.com/ttddyy/datasource-proxy, but this will require more changes in Spring configuration, as we would need to post-process the datasource bean like here

@maciejwalkowiak maciejwalkowiak marked this pull request as ready for review October 26, 2021 17:27
@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2021

Codecov Report

Merging #1784 (7a6cf7d) into main (29232bd) will increase coverage by 0.01%.
The diff coverage is 90.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1784      +/-   ##
============================================
+ Coverage     75.72%   75.73%   +0.01%     
- Complexity     2173     2180       +7     
============================================
  Files           215      216       +1     
  Lines          7719     7739      +20     
  Branches        821      824       +3     
============================================
+ Hits           5845     5861      +16     
- Misses         1474     1477       +3     
- Partials        400      401       +1     
Impacted Files Coverage Δ
...n/java/io/sentry/jdbc/SentryJdbcEventListener.java 90.00% <90.00%> (ø)
...n/java/io/sentry/transport/ReusableCountLatch.java 82.35% <0.00%> (-5.89%) ⬇️

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 29232bd...7a6cf7d. Read the comment docs.

settings.gradle.kts Outdated Show resolved Hide resolved
@marandaneto
Copy link
Contributor

@maciejwalkowiak next step is docs under sentry-docs, release-registry and craft configuration

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

🚀

@bruno-garcia bruno-garcia merged commit 776d87c into main Oct 28, 2021
@bruno-garcia bruno-garcia deleted the p6spy branch October 28, 2021 17:02
@bruno-garcia
Copy link
Member

@maciejwalkowiak next step is docs under sentry-docs, release-registry and craft configuration

Craft was done in this PR. Missing release-registry and docs.

maciejwalkowiak added a commit to maciejwalkowiak/sentry-docs that referenced this pull request Nov 1, 2021
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.

5 participants