fix(debugger): redact nullable wrappers of configured types#8642
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5bd78c8852
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var effectiveType = Nullable.GetUnderlyingType(type) ?? type; | ||
| return _redactedTypesCache.GetOrAdd(effectiveType, CheckForRedactedType); |
There was a problem hiding this comment.
Preserve nullable-wrapper redaction rules
When a user configures DD_DYNAMIC_INSTRUMENTATION_REDACTED_TYPES=System.Nullable* (or an exact nullable wrapper type name), nullable values used to match because CheckForRedactedType inspected the wrapper's FullName. After always passing only the underlying type into the cache/check, those existing wrapper-specific wildcard rules never see System.Nullable..., so nullable values can be emitted despite an active redaction rule. Consider evaluating both the original wrapper type and the underlying type.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I'm not sure if this is necessary or not? 🤔 As I understand it, we didn't use to "support" nullable types at all previously? So this shouldn't break existing customers if they're currently specifying the full nullable type. And if that's the case, I think the existing fix is fine? 🤔
There was a problem hiding this comment.
I agree with Andrew, but let’s be on the safe side.
ea2f9a9
BenchmarksBenchmark execution time: 2026-05-15 12:59:14 Comparing candidate commit ea2f9a9 in PR branch Some scenarios are present only in baseline or only in candidate runs. If you didn't create or remove some scenarios in your branch, this maybe a sign of crashed benchmarks 💥💥💥 Scenarios present only in baseline:
Found 1 performance improvements and 3 performance regressions! Performance is the same for 48 metrics, 20 unstable metrics, 84 known flaky benchmarks, 42 flaky benchmarks without significant changes.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8642) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8642) - mean (72ms) : 70, 75
master - mean (74ms) : 70, 79
section Bailout
This PR (8642) - mean (79ms) : 74, 84
master - mean (78ms) : 74, 81
section CallTarget+Inlining+NGEN
This PR (8642) - mean (1,107ms) : 1057, 1157
master - mean (1,100ms) : 1043, 1157
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8642) - mean (116ms) : 109, 124
master - mean (115ms) : 110, 119
section Bailout
This PR (8642) - mean (117ms) : 112, 122
master - mean (115ms) : 111, 118
section CallTarget+Inlining+NGEN
This PR (8642) - mean (790ms) : 763, 816
master - mean (787ms) : 758, 816
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8642) - mean (104ms) : 98, 110
master - mean (104ms) : 98, 109
section Bailout
This PR (8642) - mean (103ms) : 101, 105
master - mean (103ms) : 99, 106
section CallTarget+Inlining+NGEN
This PR (8642) - mean (948ms) : 909, 987
master - mean (945ms) : 904, 986
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8642) - mean (100ms) : 96, 104
master - mean (98ms) : 95, 102
section Bailout
This PR (8642) - mean (104ms) : 98, 110
master - mean (101ms) : 97, 105
section CallTarget+Inlining+NGEN
This PR (8642) - mean (825ms) : 789, 861
master - mean (819ms) : 774, 865
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8642) - mean (201ms) : 196, 206
master - mean (199ms) : 195, 204
section Bailout
This PR (8642) - mean (204ms) : 201, 207
master - mean (202ms) : 197, 206
section CallTarget+Inlining+NGEN
This PR (8642) - mean (1,206ms) : 1142, 1270
master - mean (1,204ms) : 1154, 1253
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8642) - mean (286ms) : 280, 293
master - mean (289ms) : 278, 299
section Bailout
This PR (8642) - mean (289ms) : 282, 295
master - mean (290ms) : 281, 298
section CallTarget+Inlining+NGEN
This PR (8642) - mean (965ms) : 947, 983
master - mean (965ms) : 948, 982
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8642) - mean (279ms) : 274, 284
master - mean (281ms) : 273, 289
section Bailout
This PR (8642) - mean (279ms) : 274, 285
master - mean (281ms) : 274, 289
section CallTarget+Inlining+NGEN
This PR (8642) - mean (1,156ms) : 1125, 1187
master - mean (1,170ms) : 1132, 1208
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8642) - mean (280ms) : 275, 286
master - mean (278ms) : 271, 285
section Bailout
This PR (8642) - mean (279ms) : 273, 285
master - mean (279ms) : 271, 286
section CallTarget+Inlining+NGEN
This PR (8642) - mean (1,038ms) : 990, 1086
master - mean (1,039ms) : 993, 1084
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var effectiveType = Nullable.GetUnderlyingType(type) ?? type; | ||
| return _redactedTypesCache.GetOrAdd(effectiveType, CheckForRedactedType); |
There was a problem hiding this comment.
I'm not sure if this is necessary or not? 🤔 As I understand it, we didn't use to "support" nullable types at all previously? So this shouldn't break existing customers if they're currently specifying the full nullable type. And if that's the case, I think the existing fix is fine? 🤔
5bd78c8 to
ea2f9a9
Compare
Motivation
Nullable<T>was added toIsSafeToCallToString, but type-redaction checks still used the original wrapper type, allowing configured redacted underlying types (e.g.,System.Guid) to be bypassed when serialized asGuid?.ToStringvalue types could be emitted without redaction.Description
Nullable<T>before checking/caching inRedaction.IsRedactedTypeso configured redacted underlying types apply to nullable wrappers as well (tracer/src/Datadog.Trace/Debugger/Snapshots/Redaction.cs).IsRedactedType_WithConfiguredUnderlyingNullableType_Testto assertGuid?is redacted whenSystem.Guidis configured as redacted (tracer/test/Datadog.Trace.Tests/Debugger/RedactionTests.cs).ShouldRedacttheory to include aGuid?case and includeSystem.Guidin the test configuration to cover the end-to-end decision path.Testing
dotnet test tracer/test/Datadog.Trace.Tests/Datadog.Trace.Tests.csproj --filter "FullyQualifiedName~Datadog.Trace.Tests.Debugger.RedactionTests" --no-restore, and the modified redaction tests passed on supported TFMs in this environment.Codex Task