Improve trace secret masking with x/text/transform
What does this MR do?
Improves trace performance by using efficient text transforms for masking secrets.
Why was this MR needed?
- Improves performance
- Will allow us to scrub URLs with another transformer implemenation. We currently use regex to do this and it is incredibly slow.
- Fixes an issue where a
secret
would not be masked if it duplicated the first character (ie.ssecret
).
Old benchmarks
BenchmarkBuffer10k-16 99 115428652 ns/op 17.33 MB/s 10407127 B/op 190037 allocs/op
New benchmarks
BenchmarkBuffer10k-16 307 39174771 ns/op 51.05 MB/s 9416 B/op 24 allocs/op
What's the best way to test this MR?
Previous test traces continue to work. The new masking functionality has an array of new tests.
go test ./helpers/trace
What are the relevant issue numbers?
closes #16705 (closed)
Edited by Arran Walker