Capture Cassandra batch queries#18964
Merged
trask merged 10 commits intoJun 12, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the incubating SQL semantic-conventions extractor to support per-query parameterization (via an indexed isParameterizedQuery(request, queryIndex) hook) so batch requests with mixed parameterization can sanitize only the non-parameterized entries, and updates Cassandra (3.0/4.0/4.4) instrumentation to supply per-entry query texts and batch size.
Changes:
- Add
SqlClientAttributesGetter.isParameterizedQuery(request, queryIndex)(and update extractors) to enable per-query sanitization within multi-query requests. - Update Cassandra 3.0/4.0/4.4 request capture to support multi-query/batch query texts, per-entry parameterization, and
db.operation.batch.size. - Add tests covering same-query and mixed-query Cassandra batches and mixed-parameterized multi-query extraction.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| instrumentation/vertx/vertx-sql-client/vertx-sql-client-common-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/sqlclient/common/v4_0/VertxSqlClientAttributesGetter.java | Implements indexed parameterization hook for Vert.x SQL client requests. |
| instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/internal/R2dbcSqlAttributesGetter.java | Implements indexed parameterization hook for R2DBC executions. |
| instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/internal/JdbcAttributesGetter.java | Implements indexed parameterization hook for JDBC requests. |
| instrumentation/cassandra/cassandra-common-4.0/testing/src/main/java/io/opentelemetry/cassandra/common/v4_0/AbstractCassandraTest.java | Adds batch tests validating query text capture/sanitization and batch size attribute. |
| instrumentation/cassandra/cassandra-4.4/library/src/main/java/io/opentelemetry/instrumentation/cassandra/v4_4/TracingCqlSession.java | Switches Cassandra request creation to statement-aware factory for batch support. |
| instrumentation/cassandra/cassandra-4.4/library/src/main/java/io/opentelemetry/instrumentation/cassandra/v4_4/CassandraSqlAttributesGetter.java | Exposes multi-query texts, batch size, and indexed parameterization for 4.4 library. |
| instrumentation/cassandra/cassandra-4.4/library/src/main/java/io/opentelemetry/instrumentation/cassandra/v4_4/CassandraRequest.java | Extends request model to hold multiple query texts, per-entry parameterization, and batch size (with deprecations). |
| instrumentation/cassandra/cassandra-4.4/library/src/main/java/io/opentelemetry/instrumentation/cassandra/v4_4/CassandraAttributesExtractor.java | Adjusts extractor to use new session accessor. |
| instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/TracingCqlSession.java | Switches Cassandra request creation to statement-aware factory for batch support (javaagent). |
| instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraSqlAttributesGetter.java | Exposes multi-query texts, batch size, and indexed parameterization for 4.0 javaagent. |
| instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraRequest.java | Extends request model to hold multiple query texts, per-entry parameterization, and batch size (javaagent). |
| instrumentation/cassandra/cassandra-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraClientTest.java | Adds batch tests validating query text capture/sanitization and batch size attribute (3.0). |
| instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/TracingSession.java | Switches Cassandra request creation to statement-aware factory for batch support (3.0). |
| instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraSqlAttributesGetter.java | Exposes multi-query texts, batch size, and indexed parameterization for 3.0 javaagent. |
| instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraRequest.java | Extends request model to hold multiple query texts, per-entry parameterization, and batch size (3.0). |
| instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesExtractorTest.java | Adds test coverage for mixed-parameterized multi-query sanitization behavior. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesGetter.java | Deprecates old parameterization hook and adds indexed parameterization hook. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesExtractor.java | Updates sanitization logic to evaluate parameterization per query index in batches. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/MultiQuery.java | Refactors multi-query analysis to a builder to support per-entry sanitized/raw text selection. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientSpanNameExtractor.java | Updates multi-query helper invocation after MultiQuery refactor. |
7d9a761 to
bfd85a2
Compare
bfd85a2 to
2af0f4b
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ef0305e to
bdbada8
Compare
1e74aaf to
84a4219
Compare
84a4219 to
9c50ffd
Compare
9c50ffd to
91d3530
Compare
laurit
approved these changes
Jun 12, 2026
Cassandra batch setup only emits traces for the three executed schema statements; preparing the batch statement does not create a trace, so the tests timed out while draining four traces before the real assertion. Pulsar latest dependencies can emit extra receive-only spans for multi-topic consumption, and one-message batch receive spans may report batch count instead of an individual message id. The test now asserts the required publish, receive, and process spans directly instead of relying on an exact trace count. Validation: .\gradlew.bat :instrumentation:cassandra:cassandra-3.0:javaagent:test --tests io.opentelemetry.javaagent.instrumentation.cassandra.v3_0.CassandraClientTest.batchStatementWithSameQuery --tests io.opentelemetry.javaagent.instrumentation.cassandra.v3_0.CassandraClientTest.batchStatementWithDifferentQueries :instrumentation:cassandra:cassandra-4.0:javaagent:test --tests io.opentelemetry.javaagent.instrumentation.cassandra.v4_0.CassandraTest.batchStatementWithSameQuery --tests io.opentelemetry.javaagent.instrumentation.cassandra.v4_0.CassandraTest.batchStatementWithDifferentQueries :instrumentation:cassandra:cassandra-4.4:javaagent:test --tests io.opentelemetry.javaagent.instrumentation.cassandra.v4_4.CassandraTest.batchStatementWithSameQuery --tests io.opentelemetry.javaagent.instrumentation.cassandra.v4_4.CassandraTest.batchStatementWithDifferentQueries :instrumentation:cassandra:cassandra-4.4:library:test --tests io.opentelemetry.instrumentation.cassandra.v4_4.CassandraTest.batchStatementWithSameQuery --tests io.opentelemetry.instrumentation.cassandra.v4_4.CassandraTest.batchStatementWithDifferentQueries :instrumentation:pulsar:pulsar-2.8:javaagent:test --tests io.opentelemetry.javaagent.instrumentation.pulsar.v2_8.PulsarClientTest.testConsumeMultiTopics .\gradlew.bat :instrumentation:pulsar:pulsar-2.8:javaagent:test -PtestLatestDeps=true --tests io.opentelemetry.javaagent.instrumentation.pulsar.v2_8.PulsarClientTest.testConsumeMultiTopics .\gradlew.bat :instrumentation:cassandra:cassandra-3.0:javaagent:spotlessCheck :instrumentation:cassandra:cassandra-common-4.0:testing:spotlessCheck :instrumentation:pulsar:pulsar-2.8:javaagent:spotlessCheck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary