JDBC Instrumentation
Capturing transactions requires that you first set up performance monitoring if you haven't already.
Sentry JDBC integration provides the SentryJdbcEventListener
for P6Spy database activity interceptor, which creates a span for each JDBC statement executed over a proxied instance of javax.sql.DataSource
.
Install
Copied
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-jdbc</artifactId>
<version>7.13.0</version>
</dependency>
For other dependency managers, check out the central Maven repository.
Configure the DataSource
to use com.p6spy.engine.spy.P6SpyDriver
as a JDBC driver. For Spring Boot applications:
Copied
spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver
Add the p6spy
prefix to the database connection URL. For Spring Boot applications:
Copied
spring.datasource.url: jdbc:p6spy:postgresql://localhost:5432/db
P6Spy uses a Java Service Loader mechanism to register JdbcEventListener
s. For more configuration options, check the P6Spy Reference Guide.
- Package:
- maven:io.sentry:sentry-spring
- Version:
- 7.13.0
- Repository:
- https://github.com/getsentry/sentry-java