pub enum QueryTextMode {
Full,
Obfuscated,
Off,
}Expand description
Controls whether and how db.query.text is captured on spans.
Configured via PoolBuilder::with_query_text_mode.
§When to choose what
Full(default) – appropriate when all SQL flows throughSQLxbind parameters. The captured text contains placeholders ($1,?), not literal values, so user data does not leak into the span.Obfuscated– appropriate when SQL is built via string interpolation (format!, query concatenation, dynamic identifiers) and may contain literal values. Structure is preserved; literals (string, numeric, hex, boolean, andPostgreSQLdollar-quoted) are replaced with?. Comments, whitespace, identifiers (quoted or otherwise), operators, andNULLare kept verbatim.Off– appropriate when the query text is itself sensitive (proprietary schemas, query shapes that reveal business logic) or when query-text cardinality must be eliminated entirely.
db.query.parameter.<key> capture is not supported – SQLx’s Execute trait does
not expose bind values, and reverse-engineering them from the encoded buffer would tie
the wrapper to driver internals. Callers who need per-parameter attributes can add
them manually via the active span using the OpenTelemetry API.
Variants§
Full
Capture the parameterised query text as-is. This is the default because SQLx
queries use bind parameters ($1, ?), so literal values are not present in the
query string.
Obfuscated
Replace literal values in the query text with ?. Useful when queries are built
via string interpolation rather than bind parameters.
Off
Do not capture db.query.text at all.
Trait Implementations§
Source§impl Clone for QueryTextMode
impl Clone for QueryTextMode
Source§fn clone(&self) -> QueryTextMode
fn clone(&self) -> QueryTextMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QueryTextMode
impl Debug for QueryTextMode
Source§impl Default for QueryTextMode
impl Default for QueryTextMode
Source§fn default() -> QueryTextMode
fn default() -> QueryTextMode
Source§impl PartialEq for QueryTextMode
impl PartialEq for QueryTextMode
impl Copy for QueryTextMode
impl Eq for QueryTextMode
impl StructuralPartialEq for QueryTextMode
Auto Trait Implementations§
impl Freeze for QueryTextMode
impl RefUnwindSafe for QueryTextMode
impl Send for QueryTextMode
impl Sync for QueryTextMode
impl Unpin for QueryTextMode
impl UnsafeUnpin for QueryTextMode
impl UnwindSafe for QueryTextMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more