Skip to content

#83 Add optional per-query filter to WithIncludeQueryParameters#84

Open
nikolayk812 wants to merge 1 commit into
exaring:mainfrom
nikolayk812:83-query-parameters-filter
Open

#83 Add optional per-query filter to WithIncludeQueryParameters#84
nikolayk812 wants to merge 1 commit into
exaring:mainfrom
nikolayk812:83-query-parameters-filter

Conversation

@nikolayk812

Copy link
Copy Markdown

WithIncludeQueryParameters currently records all query parameters or none. This adds an optional filter function so you can skip recording parameters for specific queries (e.g. those touching sensitive tables like users or
payments).

Since pgx uses positional parameters ($1, $2, …) with no named arg support, per-argument redaction isn't practical — per-query is the right granularity.

Usage:

  otelpgx.WithIncludeQueryParameters(func(sql string) bool {
      return !strings.Contains(sql, "payments")
  })

Fully backwards compatible — existing WithIncludeQueryParameters() calls with no filter are unchanged.

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.

1 participant