Skip to content

Add option to remove params from traces#3045

Merged
tyt2y3 merged 3 commits intoSeaQL:masterfrom
WaterWhisperer:feat/option-to-remove-from-traces
Apr 16, 2026
Merged

Add option to remove params from traces#3045
tyt2y3 merged 3 commits intoSeaQL:masterfrom
WaterWhisperer:feat/option-to-remove-from-traces

Conversation

@WaterWhisperer
Copy link
Copy Markdown
Contributor

@WaterWhisperer WaterWhisperer commented Apr 14, 2026

PR Info

New Features

  • Add ConnectOptions::tracing_statement_logging(bool) to let users disable db.statement recording when tracing-spans is enabled.

Changes

  • Propagate the statement-logging setting through DatabaseConnection and DatabaseTransaction.
  • Keep the current default behavior unchanged, db.statement is still recorded unless explicitly disabled.

@WaterWhisperer
Copy link
Copy Markdown
Contributor Author

I used expect instead of allow because of servo/servo#40383 (comment). However, to maintain consistency in the codebase, I could use allow, but personally, I might prefer expect.

@tyt2y3
Copy link
Copy Markdown
Member

tyt2y3 commented Apr 14, 2026

thank you! just to confirm, you used the shell script to regenerate sea-orm-sync right?

@WaterWhisperer
Copy link
Copy Markdown
Contributor Author

thank you! just to confirm, you used the shell script to regenerate sea-orm-sync right?

Oh, sorry, I updated the sync side manually. I didn't know there was a script to use before. I’ll rerun the script and update the PR

@WaterWhisperer WaterWhisperer force-pushed the feat/option-to-remove-from-traces branch from ab2cf80 to b1ec898 Compare April 15, 2026 02:28
Comment thread sea-orm-sync/src/database/mod.rs Outdated
@Huliiiiii
Copy link
Copy Markdown
Member

#2941 wanted was to only remove the parameter. This change just disables statement recording in spans, so it doesn’t seem to fully resolve that issue.

@WaterWhisperer
Copy link
Copy Markdown
Contributor Author

#2941 wanted was to only remove the parameter. This change just disables statement recording in spans, so it doesn’t seem to fully resolve that issue.

Yeah the current change only adds a switch for whether db.statement is recorded in spans.

After rechecking the current implementation and testing it locally, it looks like the tracing span path records stmt.sql (with placeholders), not the rendered SQL with bound parameters. The parameter injection seems to happen in Statement’s Display impl, which is used by debug logging, not by tracing-spans.

So I may be targeting a different concern than #2941 originally described. Does #2941 refer to another current path that records rendered SQL with parameters, or to an older behavior?

@Huliiiiii
Copy link
Copy Markdown
Member

Perhaps it's because of tracing::instrument.

@WaterWhisperer
Copy link
Copy Markdown
Contributor Author

Perhaps it's because of tracing::instrument.

Thanks! After looking into it again, I think the real concern in #2941 may be #[instrument] recording stmt: Statement, rather than db.statement itself.

If that’s the case, then this PR may be addressing a separate concern: whether raw SQL is recorded into db.statement.

Would you prefer me to keep this PR scoped as that separate option, or would it be better to rework/replace it with a focused fix for the #[instrument] related issue? If a new PR would be cleaner for review, I’m happy to close this one and open another.

@Huliiiiii
Copy link
Copy Markdown
Member

Keep this PR and open a separate one for the tracing::instrument issue.

@tyt2y3 tyt2y3 merged commit f5c212b into SeaQL:master Apr 16, 2026
39 checks passed
@WaterWhisperer WaterWhisperer deleted the feat/option-to-remove-from-traces branch April 16, 2026 15:32
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.

3 participants