Add db.query.summary support to Geode instrumentation #15925
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.
Implements
db.query.summaryattribute extraction for Geode instrumentation to support low-cardinality span names in stable semconv mode.Changes
SqlStatementInfoinstead of raw query string, enabling access to both sanitized query text and query summarySqlStatementInfofor query text and implementsgetDbQuerySummary()DB_QUERY_TEXTreplacesDB_STATEMENTExample
In stable semconv mode, Geode query spans now use the query summary for the span name:
Query summary extraction follows SQL semantic conventions, providing operation + collection name for improved observability with bounded cardinality.
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/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/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
Implementation Guide: Adding
db.query.summarySupport to Geode InstrumentationQuick Start
This guide shows how to add
db.query.summarysupport to Geode instrumentation (version 1.4).Prerequisites
CRITICAL: You must cherry-pick changes from PR #15909 and PR #15896. PR #15909 adds support for using
db.query.summaryas the span name when available (in stable semconv mode). PR #15896 adds theSqlStatementInfo.getQuerySummary()method.Current State
The Geode instrumentation uses
SqlStatementSanitizerdirectly inGeodeDbAttributesGetter.getDbQueryText()to sanitize queries. Unlike other instrumentations, it doesn't store aSqlStatementInfoobject. TheGeodeDbAttributesGettercurrently provides:getDbSystemName()- returns "geode"getDbNamespace()- returns the region namegetDbQueryText()- returns sanitized query textgetDbOperationName()- returns the operation (e.g., "get", "put", "query")Implementation Steps
1. Store SqlStatementInfo in GeodeRequest
File:
instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeRequest.javaChanges needed:
SqlStatementInfofield to store parsed query informationcreate()method to createSqlStatementInfofrom the query parameterSqlStatementInfoExample:
2. Update GeodeRegionInstrumentation to Create SqlStatementInfo
File:
instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeRegionInstrumentation.javaChanges needed:
Update the advice methods to pass the query to
GeodeRequest.create(), which will handle creatingSqlStatementInfointernally.Example:
3. Update GeodeDbAttributesGetter
File:
instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeDbAttributesGetter.javaChanges needed:
SqlStatementSanitizerfield and direct usage ingetDbQueryText()getDbQueryText()to delegate toSqlStatementInfo.getQueryText()getDbQuerySummary()method that delegates toSqlStatementInfo.getQuerySummary()request.getQuery()to userequest.getSqlStatementInfo().getQueryText()insteadExample:
4. Update Tests for Stable Semconv
File:
instrumentation/geode-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/geode/PutGetTest.javaChanges needed:
DB_QUERY_SUMMARYandemitStableDatabaseSemconv()db.query.summaryin stable semconv modedb.operationbased on semcon...💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.