[Http] Redact only named query string parameters - #4954
Conversation
…PARAMETERS env variable that names the parameters to redact and preserves the rest.
Pull request dashboard statusWaiting on reviewers · refreshed 2026-08-15 20:05 UTC Review the latest changes. Status above doesn't look right?
|
My initial thought is that we should stick with the README and not overwrite it, which effectively means implementing this request is two pieces of work, because the .NET runtime would also need to implement it. However they almost certainly won't implement it while it's non-stable. Here's some further links and context here around how |
…ntationOptions.cs Co-authored-by: Martin Costello <martin@martincostello.com>
…avior and updated accompanying files
|
@martincostello I updated the SensitiveQueryParameters description and removed the change in I also updated the description of PR, please re-review when time permits. With your comment in mind for |
|
@rajkumar-rangaraj Thoughts on the path forward for this PR after our discussion in the SIG call this Tuesday? |
Fixes #1791
Changes
OTEL_DOTNET_EXPERIMENTAL_HTTPCLIENT_SENSITIVE_QUERY_PARAMETERStakes a comma-separated list of query parameter names. Those values are replaced withREDACTEDinurl.full; every other value survives.Names are matched case-sensitively, per semconv. Applies to .NET Framework and up to .NET 8.
There are no default query parameters giving the user full control.
Open questions
RedactionHelper.SensitiveRedactedText- should it be a separate variable or should existingRedactionHelper.RedactedTextbe used? A new variable was added since semconv states that REDACTED should be uppercase. I am happy to use the existing one to maintain consistent behavior, or update all usages of the existing one to the new one.HttpHandlerDiagnosticListener(lines150-159, .NET 9+ runtimes) - Runtime writesurl.fullitself and redacts the query to ?*. When this variable is set, the instrumentation overwrites that one attribute. This goes against the README's "does not override native instrumentation" guarantee (line 47) for opted-in users. Should this change be removed or should the README be amended?Resolved: per suggestion below, .NET 9+ behavior remains the same
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes