Skip to content

Rename isParameterizedQuery to isQuerySanitizationNeeded#15890

Closed
Copilot wants to merge 7 commits intomainfrom
copilot/rename-method-query-sanitization
Closed

Rename isParameterizedQuery to isQuerySanitizationNeeded#15890
Copilot wants to merge 7 commits intomainfrom
copilot/rename-method-query-sanitization

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 17, 2026

Implements suggestion from PR #15855 to rename the method for improved clarity and eliminate double-negative logic.

Changes

  • Interface: SqlClientAttributesGetter.isParameterizedQuery()isQuerySanitizationNeeded()

    • Inverted boolean semantics: returns true when sanitization is needed (was true when parameterized)
    • Updated default from return false to return true for backward compatibility
    • Updated javadoc to reflect new semantics
  • Caller simplification in SqlClientAttributesExtractor:

    // Before
    boolean parameterizedQuery = getter.isParameterizedQuery(request);
    boolean shouldSanitize = statementSanitizationEnabled && !parameterizedQuery;
    
    // After
    boolean shouldSanitize = statementSanitizationEnabled && getter.isQuerySanitizationNeeded(request);
  • Implementation updates: Inverted boolean logic across all implementations:

    • JDBC: PreparedStatement → false (was true), Statement → true (was false)
    • Cassandra (3.0, 4.0, 4.4): BoundStatement → !(statement instanceof BoundStatement)
    • Vert.x SQL Client (4.0, 5.0): PreparedStatement → !preparedStatement
    • R2DBC: anyMatch(!isEmpty)allMatch(isEmpty) (De Morgan equivalence)

19 files updated across all SQL database instrumentation modules.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • develocity.opentelemetry.io
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)
  • scans-in.gradle.com
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

implement suggestion #15855 (comment)

rename method to isQuerySanitizationNeeded


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 17, 2026 02:58
…d logic

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI changed the title [WIP] Rename method to isQuerySanitizationNeeded Rename isParameterizedQuery to isQuerySanitizationNeeded Jan 17, 2026
Copilot AI requested a review from trask January 17, 2026 03:08
@github-actions github-actions Bot added the test native This label can be applied to PRs to trigger them to run native tests label Jan 17, 2026
@trask trask force-pushed the copilot/rename-method-query-sanitization branch from 579a2f2 to 45dc6ea Compare January 17, 2026 04:15
default boolean isParameterizedQuery(REQUEST request) {
return false;
default boolean isQuerySanitizationNeeded(REQUEST request) {
return true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@laurit I'm not sure I like this better as it could be confused also with the query sanitization settings

@trask trask closed this Jan 27, 2026
@trask trask deleted the copilot/rename-method-query-sanitization branch March 15, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test native This label can be applied to PRs to trigger them to run native tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants