Skip to content

feat: Compact whitespace in db.query.text by default - #34

Merged
chmodas merged 1 commit into
trunkfrom
query-text-compaction
May 4, 2026
Merged

feat: Compact whitespace in db.query.text by default#34
chmodas merged 1 commit into
trunkfrom
query-text-compaction

Conversation

@chmodas

@chmodas chmodas commented May 4, 2026

Copy link
Copy Markdown
Owner

Both QueryTextMode::Full (default) and QueryTextMode::Obfuscated now collapse inter-token whitespace runs to a single space and trim leading/trailing whitespace before emitting db.query.text. Whitespace inside string literals, quoted identifiers, dollar-quoted bodies, and comments is preserved verbatim. Multi-line SQL written for source-level readability now renders as a single readable line in OTel exports without padding the captured value with embedded \n and indentation runs. QueryTextMode::Off is unchanged.

The new compact_whitespace pass runs at the executor dispatch site as compact_whitespace(sql) for Full and compact_whitespace(obfuscate(sql)) for Obfuscated, keeping value redaction and whitespace cosmetics decoupled.

@codecov-commenter

codecov-commenter commented May 4, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.96%. Comparing base (00f43f2) to head (f8fc91f).
⚠️ Report is 1 commits behind head on trunk.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##            trunk      #34    +/-   ##
========================================
  Coverage   99.95%   99.96%            
========================================
  Files          12       13     +1     
  Lines        2182     2552   +370     
========================================
+ Hits         2181     2551   +370     
  Misses          1        1            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Both QueryTextMode::Full (default) and QueryTextMode::Obfuscated now collapse
inter-token whitespace runs to a single space and trim leading/trailing
whitespace before emitting db.query.text. Whitespace inside string literals,
quoted identifiers, dollar-quoted bodies, and comments is preserved verbatim.
Multi-line SQL written for source-level readability now renders as a single
readable line in OTel exports without padding the captured value with embedded
`\n` and indentation runs. QueryTextMode::Off is unchanged.

The new compact_whitespace pass runs at the executor dispatch site as
`compact_whitespace(sql)` for Full and `compact_whitespace(obfuscate(sql))` for
Obfuscated, keeping value redaction and whitespace cosmetics decoupled.
@chmodas
chmodas force-pushed the query-text-compaction branch from dd2fcb9 to f8fc91f Compare May 4, 2026 20:54
@chmodas
chmodas merged commit d10eab7 into trunk May 4, 2026
2 checks passed
@chmodas
chmodas deleted the query-text-compaction branch May 4, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants