Sampling
Control how much data is collected per entry-point type. Exceptions and 5xx requests are always kept regardless of sample rate — when something breaks, you’ll see it.NIGHTOWL_SAMPLE_RATE=0.25 and let the per-type overrides specialize. See the throughput guide for how to pick a rate.
In-code filtering
Use Nightwatch’s filtering API to exclude specific events inline:Context metadata
Attach custom key-value data to traces using Laravel’sContext facade (Laravel 11+):
MAX_PAYLOAD_BYTES) — oversized payloads are rejected with 5:ERROR, not silently truncated — so keep context entries small and structured rather than pushing large blobs through the tracer.
Good things to stash in context:
- Tenant / workspace / organization ID.
- Feature flag decisions that affected this request.
- User role or permission set.
- Deploy-specific debugging flags you set temporarily during an incident.
Context entries are not run through the redactor.
Redaction
For secrets that might end up in request bodies, query strings, or exception context, enable the agent’s redactor. It scrubs keys before rows reach PostgreSQL:- Matches keys case-insensitively at any depth in the payload JSON.
- Redacts URL query-string params whose key matches one of the redact keys, inside fields named
url,uri,endpoint, orhref. - Replaces the value with
[REDACTED]— the key stays so downstream analysis knows the field existed.
Combining the layers
A common production config looks like:Nightwatch::ignore() around health-check endpoints and Context::add() for tenant IDs, you get a dataset that’s lean, safe to store, and actually queryable.