Trace Redaction and Sampling
In this article
- Explain why a trace that records every tool argument leaks secrets and customer data, and which real tracing tools do that by default.
- Write an attribute allowlist that keeps what on-call needs, hashes with a key what must stay linkable, and drops tokens.
- Set a rule for raw payloads: when they are kept, where, for how long and for whom.
- Find a failing tool call from a redacted record by order id and error class.
- Terms defined here: log redaction, log sampling.
Overview
Your support assistant just refunded a customer. To do it, one tool call handled the customer's email address and the token your code uses to talk to the payments service. If your trace of the run records that call in full, both now sit in a store every engineer on call can search. Record too little, and the next failing refund is a mystery nobody can reproduce.
Here is how to write a short allowlist that keeps what on-call needs and drops the rest, plus a rule for when raw payloads are kept, where and for how long. The test at the end: find a failing call from a redacted record alone.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- What one tool call would leak
- Keep the shape, drop the contents
- Why a plain hash is not redaction
- Raw payloads: when, where, how long
- Finding the failing call
- The rule at work
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions