Sampling and redaction
Sampling controls record volume. Redaction removes configured sensitive fields.
Sampling
Section titled “Sampling”Sampling values are numbers from 0 to 1.
const runtime = observability({ name: "runtime", namespace: "api", sampling: { success: 0.25, error: 1, },})In this example, Layeron emits about 25 percent of success records and all error records.
Use lower success sampling for high-volume routes. Use full error sampling when every failure matters.
Redaction
Section titled “Redaction”Redaction replaces matching field names before attributes leave the handler:
const runtime = observability({ name: "runtime", namespace: "api", redaction: { fields: ["authorization", "cookie", "token"], },})Keep these values out of attributes:
- Access tokens.
- Passwords.
- Cookies.
- Raw authorization headers.
- Raw provider payloads.
- Full request bodies.