Repository navigation
Conversation
|
JVM timing with and without sanitizationPer query, in microseconds (µs). Measured on
Machine: Apple M4 Pro (14 cores, 48 GB), macOS 27.2.1, Temurin OpenJDK 17.0.13. Not idle: load average 4.7–5.5 during the runs (Gradle daemon and desktop apps). How often: 2 runs of 3 rounds each. Per round and statement: 6,000 measured calls per variant after 3,000 warm-up calls (100-parameter Setup:
Reading:
|
PR risk: mediumFor commit Main concerns: data sent to Sentry, host performance, reach. Rules that block low also fired:
This label is a hint for reviewers, not an approval. |
📲 Install BuildsAndroid
|
PR Stack (SQL Sanitizing)
📜 Description
Wires the SQL query analyzer from #6795 into
sentry-jdbc.SentryJdbcEventListeneranalyzes each statement inonBeforeAnyExecute, in the dialect of its connection's database system. The span description is the sanitized text (at most 32 KiB). The span also getsdb.query.text,db.query.summaryanddb.stored_procedure.namewhen present, anddb.system.nameanddb.namespacenext to the existingdb.systemanddb.name. If the analysis fails, the span keeps no query text at all, never the raw statement.auto.db.jdbcis an ignored span origin (the default in the OpenTelemetry agent and agentless-spring modes), the listener no longer reads the statement or the URL. The span would have been a no-op.DatabaseUtils: file-based database names (SQLite, H2, HSQLDB, Derby) are cut at;,?and#, so connection properties such as?password=…or?key=…no longer end up indb.name. URLs without a database path (jdbc:postgresql://host:5432/) give nodb.nameinstead of an empty one.sentry-test-support:hasSpanWithOpAndDescriptiontakes an optional map of span data that some span with that op and description must carry.💡 Motivation and Context
JDBC spans carry the raw SQL statement today, including literal values from statements that don't use bind parameters.
💚 How did you test it?
./gradlew :sentry-jdbc:check: 58 tests, 0 failures. The listener tests check wiring only: span fields equalSqlQueryAnalyzer's output for the URL's database system, so a grammar sync never needs re-baselining. The per-URL test uses a statement whose output differs between MySQL and PostgreSQL. Each new test was checked against a mutation of the listener (raw SQL as fallback description, missing null-URL guard, empty details past the cache bound, a wrapped raw statement in span data).sentry-spring-boot,sentry-spring-boot-jakartaandsentry-spring-boot-4integrationTest,sentry-spring-boot-4integrationTestOtlpnow assertdb.query.summaryanddb.system.nameon thedb.queryspan (expected values from the analyzer); they fail against the previous listener. The threeintegrationTestOtelNoAgentsuites pass as well (ignored-origin path). The OpenTelemetry agent suites and the Spring Boot version matrix are left to CI.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
[SQL Sanitizing 3]), with on-device timing.jdbc:tc:,jdbc:aws-wrapper:,jdbc:otel:,jdbc:log4jdbc:) to report the inner database system. Not needed for sanitization: an unknown system gets the stricter dialect.#skip-changelog