Before you begin
Before you start, make sure you have:- SDK: atlanai SDK installed with tracing, as in Install atlanai SDK.
- Tracing: a working
initcall that exports traces, as in Trace your first agent run. - Decision: which data must stay out of traces. Suppress all content when payloads must never leave, mask specific values when you need most content, and sample when you need fewer traces.
The steps below are alternatives. Set every option you need in one
init call: a later call with the same API key, endpoint, workspace, service name, agent ID, and tracing mode returns the first client and ignores its other options.1
Suppress payload content
Set
trace_content to false. The SDK stops recording input, output, metadata, and tool payloads, and keeps span names, observation types, model, provider, usage, cost, and scores.It also keeps two attributes that are not content: atlan.skill.name, the skill a tool call invoked, and atlan.run.retry, which marks a run that retries an earlier, failed run of the same agent. The TypeScript pi instrumentation writes both.- Python
- TypeScript
ATLAN_TRACE_CONTENT=false does the same without a code change. It also sets atlan.consent.store_content=false on the resource, so the gateway enforces the same decision on the server side.2
Mask specific values
To redact parts of content instead of suppressing all of it, pass a Accept extra keyword arguments (If the hook raises, the SDK replaces the value with
mask hook. It runs when your own spans record input, output, and metadata, receives the value, and returns the redacted replacement.- Python
- TypeScript
**_) so the hook keeps working if a later version passes more context.[atlan: value withheld - mask hook failed] instead of sending it unmasked.mask only sees spans the SDK created. Spans from third-party instrumentation such as OpenLLMetry, OpenInference, or a framework’s native OpenTelemetry bypass it. To reach those spans, pass mask_otel_spans (Python) or maskOtelSpans (TypeScript). It runs over each export batch and returns a patch per span that deletes attributes or sets replacement values. Return no patch for a span to leave it unchanged.- Python
- TypeScript
3
Reduce trace volume
Two independent controls reduce what is exported.
- Sampling: set
sample_rate(Python) orsampleRate(TypeScript) between0.0and1.0, or setATLAN_SAMPLE_RATE. A value outside that range is ignored with a warning and treated as1.0. - Export allowlist: by default the SDK exports its own spans and spans from recognized GenAI instrumentors, and drops unrelated application spans. Pass
should_export_spanorshouldExportSpanto replace that decision entirely.
Sampling applies only when the SDK creates the TracerProvider. If your application owns the provider, configure sampling on that provider.
4
Isolate from other tracing vendor
This step is optional and applies to TypeScript. If you already export to Langfuse, Braintrust, or another OpenTelemetry backend, set To send Atlan spans through a provider your application owns, pass
isolated: true. The SDK stays off the global TracerProvider and runs a private pipeline, so neither vendor receives the other’s spans.client.spanProcessor into that provider’s constructor instead.5
Verify controls
Run one request, call
flush(), and open the trace in Atlan Trident.- With
trace_contentoff, spans show names, model, usage, and cost, with no input or output. - With a mask, the redacted replacement appears where the original value was.
- After deploying a batch hook, watch application logs for
dropping batchwarnings.
init() disables tracing and no traces are exported.Troubleshooting
If a masked or suppressed value still appears, or traces stop appearing after you add a hook, see Install and setup errors.Next steps
- Export traces from serverless: flush reliably when the process is short-lived.