Continue updating database terminology to match stable semconv (statement -> query)#16074
Merged
trask merged 3 commits intoopen-telemetry:mainfrom Feb 10, 2026
Merged
Continue updating database terminology to match stable semconv (statement -> query)#16074trask merged 3 commits intoopen-telemetry:mainfrom
trask merged 3 commits intoopen-telemetry:mainfrom
Conversation
54 tasks
7437b76 to
808a085
Compare
trask
commented
Jan 31, 2026
Member
Author
trask
left a comment
There was a problem hiding this comment.
File copy/rename annotations with diffs
| @@ -0,0 +1,96 @@ | |||
| /* | |||
Member
Author
There was a problem hiding this comment.
Copied from SqlStatementInfo.java
$ git diff upstream/main:instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlStatementInfo.java instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlQuery.java
index 9f67d55c80..cf852fc827 100644
--- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlStatementInfo.java
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlQuery.java
@@ -9,27 +9,27 @@ import com.google.auto.value.AutoValue;
import javax.annotation.Nullable;
@AutoValue
-public abstract class SqlStatementInfo {
+public abstract class SqlQuery {
private static final String SQL_CALL = "CALL";
private static final int QUERY_SUMMARY_MAX_LENGTH = 255;
- /** Creates a SqlStatementInfo for stable semconv (uses querySummary). */
- public static SqlStatementInfo createWithSummary(
+ /** Creates a SqlQuery for stable semconv (uses querySummary). */
+ public static SqlQuery createWithSummary(
@Nullable String queryText,
@Nullable String storedProcedureName,
@Nullable String querySummary) {
String truncatedQuerySummary = truncateQuerySummary(querySummary);
// In stable semconv: operationName and collectionName are always null
- return new AutoValue_SqlStatementInfo(
+ return new AutoValue_SqlQuery(
queryText, null, null, storedProcedureName, truncatedQuerySummary);
}
/**
- * Creates a SqlStatementInfo for old semconv (no querySummary). Package-private for backward
+ * Creates a SqlQuery for old semconv (no querySummary). Package-private for backward
* compatibility with old jflex-generated sanitizer.
*/
- public static SqlStatementInfo create(
+ public static SqlQuery create(
@Nullable String queryText, @Nullable String operationName, @Nullable String target) {
// AutoValue constructor: (queryText, operationName, collectionName, storedProcedureName,
// querySummary)
@@ -38,7 +38,7 @@ public abstract class SqlStatementInfo {
SQL_CALL.equals(operationName) || "EXECUTE".equals(operationName) ? null : target;
String storedProcedureName =
SQL_CALL.equals(operationName) || "EXECUTE".equals(operationName) ? target : null;
- return new AutoValue_SqlStatementInfo(
+ return new AutoValue_SqlQuery(
queryText, operationName, collectionName, storedProcedureName, null);
}| @@ -0,0 +1,101 @@ | |||
| /* | |||
Member
Author
There was a problem hiding this comment.
Copied from SqlStatementSanitizer.java
$ git diff upstream/main:instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlStatementSanitizer.java instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlQuerySanitizer.java
index d6302e64d8..6e0cc45162 100644
--- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlStatementSanitizer.java
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlQuerySanitizer.java
@@ -16,32 +16,31 @@ import javax.annotation.Nullable;
* This class is responsible for masking potentially sensitive parameters in SQL (and SQL-like)
* statements and queries.
*/
-public final class SqlStatementSanitizer {
+public final class SqlQuerySanitizer {
private static final SupportabilityMetrics supportability = SupportabilityMetrics.instance();
- private static final Cache<CacheKey, SqlStatementInfo> sqlToStatementInfoCache =
- Cache.bounded(1000);
- private static final Cache<CacheKey, SqlStatementInfo> sqlToStatementInfoCacheWithSummary =
+ private static final Cache<CacheKey, SqlQuery> sqlToStatementInfoCache = Cache.bounded(1000);
+ private static final Cache<CacheKey, SqlQuery> sqlToStatementInfoCacheWithSummary =
Cache.bounded(1000);
private static final int LARGE_STATEMENT_THRESHOLD = 10 * 1024;
- public static SqlStatementSanitizer create(boolean statementSanitizationEnabled) {
- return new SqlStatementSanitizer(statementSanitizationEnabled);
+ public static SqlQuerySanitizer create(boolean statementSanitizationEnabled) {
+ return new SqlQuerySanitizer(statementSanitizationEnabled);
}
private final boolean statementSanitizationEnabled;
- private SqlStatementSanitizer(boolean statementSanitizationEnabled) {
+ private SqlQuerySanitizer(boolean statementSanitizationEnabled) {
this.statementSanitizationEnabled = statementSanitizationEnabled;
}
- public SqlStatementInfo sanitize(@Nullable String statement) {
+ public SqlQuery sanitize(@Nullable String statement) {
return sanitize(statement, SqlDialect.DEFAULT);
}
- public SqlStatementInfo sanitize(@Nullable String statement, SqlDialect dialect) {
+ public SqlQuery sanitize(@Nullable String statement, SqlDialect dialect) {
if (!statementSanitizationEnabled || statement == null) {
- return SqlStatementInfo.create(statement, null, null);
+ return SqlQuery.create(statement, null, null);
}
// sanitization result will not be cached for statements larger than the threshold to avoid
// cache growing too large
@@ -53,20 +52,20 @@ public final class SqlStatementSanitizer {
CacheKey.create(statement, dialect), k -> sanitizeImpl(statement, dialect));
}
- private static SqlStatementInfo sanitizeImpl(String statement, SqlDialect dialect) {
+ private static SqlQuery sanitizeImpl(String statement, SqlDialect dialect) {
supportability.incrementCounter(SQL_STATEMENT_SANITIZER_CACHE_MISS);
return AutoSqlSanitizer.sanitize(statement, dialect);
}
/** Sanitize and extract query summary. */
- public SqlStatementInfo sanitizeWithSummary(@Nullable String statement) {
+ public SqlQuery sanitizeWithSummary(@Nullable String statement) {
return sanitizeWithSummary(statement, SqlDialect.DEFAULT);
}
/** Sanitize and extract query summary. */
- public SqlStatementInfo sanitizeWithSummary(@Nullable String statement, SqlDialect dialect) {
+ public SqlQuery sanitizeWithSummary(@Nullable String statement, SqlDialect dialect) {
if (!statementSanitizationEnabled || statement == null) {
- return SqlStatementInfo.createWithSummary(statement, null, null);
+ return SqlQuery.createWithSummary(statement, null, null);
}
// sanitization result will not be cached for statements larger than the threshold to avoid
// cache growing too large
@@ -78,7 +77,7 @@ public final class SqlStatementSanitizer {
CacheKey.create(statement, dialect), k -> sanitizeWithSummaryImpl(statement, dialect));
}
- private static SqlStatementInfo sanitizeWithSummaryImpl(String statement, SqlDialect dialect) {
+ private static SqlQuery sanitizeWithSummaryImpl(String statement, SqlDialect dialect) {
supportability.incrementCounter(SQL_STATEMENT_SANITIZER_CACHE_MISS);
return AutoSqlSanitizerWithSummary.sanitize(statement, dialect);
}
@@ -92,7 +91,7 @@ public final class SqlStatementSanitizer {
abstract static class CacheKey {
static CacheKey create(String queryText, SqlDialect dialect) {
- return new AutoValue_SqlStatementSanitizer_CacheKey(queryText, dialect);
+ return new AutoValue_SqlQuerySanitizer_CacheKey(queryText, dialect);
}
abstract String getQueryText();
laurit
reviewed
Feb 10, 2026
| // querySummary) | ||
| // For old semconv: derive collectionName and storedProcedureName from target based on operation | ||
| String collectionName = | ||
| SQL_CALL.equals(operationName) || "EXECUTE".equals(operationName) ? null : target; |
Contributor
There was a problem hiding this comment.
could put SQL_CALL.equals(operationName) || "EXECUTE".equals(operationName) into a variable
laurit
approved these changes
Feb 10, 2026
eb91e29 to
00f3aac
Compare
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.
Related to #12608
Renames:
SqlStatementInfo->SqlQuerySqlStatementSanitizer->SqlQuerySanitizerDeprecated old classes and updated their implementation to delegate to new classes.
Didn't introduce new tests, since the old tests cover the new classes via the delegation pattern.
When deprecated classes are removed, tests will be updated to point to the new classes.