Our team has been playing around with redact and something we're trying to wrap our heads around is how to determine if redact has modified the input. This is straightforward when the input is a string, but we're not sure what to do with objects. We've tried abusing assert_eq but the docs recommend against using assertions outside of unit tests.
An "easy" way around this problem would be if redact could return two values:
The <string | object | array> output as usual
A <boolean> indicating whether or not the output has changed
The workaround I can see for now is something along the lines of
My hesitation is that I'm not sure how expensive it is to marshal JSON twice on every log event, especially as we're operating at a decently large scale. On the other hand, Vector has made me into a Rust true believer, and maybe I'm over-thinking the performance implications.
Our team has been playing around with
redact
and something we're trying to wrap our heads around is how to determine ifredact
has modified the input. This is straightforward when the input is a string, but we're not sure what to do with objects. We've tried abusingassert_eq
but the docs recommend against using assertions outside of unit tests.An "easy" way around this problem would be if
redact
could return two values:<string | object | array>
output as usual<boolean>
indicating whether or not the output has changedThe workaround I can see for now is something along the lines of
My hesitation is that I'm not sure how expensive it is to marshal JSON twice on every log event, especially as we're operating at a decently large scale. On the other hand, Vector has made me into a Rust true believer, and maybe I'm over-thinking the performance implications.