Class SqlQueryAnalyzer

java.lang.Object
io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlQueryAnalyzer

public final class SqlQueryAnalyzer extends Object
This class is responsible for masking potentially sensitive parameters in SQL (and SQL-like) statements and queries.
  • Method Details

    • create

      public static SqlQueryAnalyzer create(boolean querySanitizationEnabled)
    • analyze

      public SqlQuery analyze(@Nullable String query, SqlDialect dialect)
      Returns sanitized query text and operation and target names.

      When quote or comment boundaries are ambiguous across dialects or connection settings, the remaining query text is replaced with ? and analysis stops.

      When sanitization is disabled, returns the original query text without analysis.

    • analyzeWithSummary

      public SqlQuery analyzeWithSummary(@Nullable String query, SqlDialect dialect)
      Returns sanitized query text, a low-cardinality summary, and operation and target names.

      When quote or comment boundaries are ambiguous across dialects or connection settings, the remaining query text is replaced with ? and summary extraction stops.

      When sanitization is disabled, returns the original query text without analysis.