Docs
DocumentationQuery ReferenceAPI Reference
Open Console→→
DocumentationQuery ReferenceAPI Reference

Platform overview

What is Axiom?QuickstartArchitectureFeatures
Fundamentals
Datasets
Edge deployments
Limits
Performance
Optimize usage
Requirements
Semantic conventions
Glossary
Tour
SecurityRoadmap

Send data

Reference architecturesMethods

Understand data

Console
Query
Builder
Editor
Query results
Visualize
Traces
Metrics
Correlations
Save queries
Stream
Dashboard
Create
Elements
Create
Configure
Element types
Gauge
Heatmap
Log stream
Monitor list
Note
Pie chart
Scatter plot
Statistic
Table
Time series
Sections
Configure
Filter
Annotate
Monitor
Overview
View status
Configure
Examples
Monitor types
Anomaly
Match
Threshold
Alerting
Overview
Configure
Notifier types
Custom Webhook
Discord
Email
Microsoft Teams
Opsgenie
PagerDuty
Slack
Manage
Datasets
Overview
Views
Virtual fields
Access
RBAC
Tokens
CLI
Organization
Audit log
Settings
Usage and billing
Profile
Extend
Overview
AWS Lambda
AWS PrivateLink
Cloudflare Workers
Cloudflare Logpush
Convex
Grafana
Hex
Netlify
Supabase
Tailscale
Terraform
Unkey
Vercel
Intelligence
Overview
Spotlight
AI agents
Overview
MCP Server
Overview
Tools
Query cost limits
Agent-created orgs
Skills
Overview
Axiom alerting
Build dashboards
Control costs
Query metrics
SRE
Translate SPL to APL
Splunk
Overview
Splunk app
Install and configure
Commands
Examples
Portal
How it works
Set up standard mode
Set up transparent mode
Observability Cloud
SPL command support
Examples
Monitor and troubleshoot

Use cases

ObservabilityProduct analytics
LLM observability
Overview
Use Axiom AI SDK
Manual instrumentation
GenAI attributes
Redaction policies

Miscellaneous

LLMs
Overview
List of docs pages
Full docs
Query reference
FAQs
Legal
Acceptable use policy
Cookies
Data processing
HIPAA
Partner agreement
Partner program guide
Privacy policy
SLA
Terms of service
Terms of use
Use cases/LLM observability

Redaction policies

This page explains how to use redaction policies in the Axiom AI SDK to control what data is captured in AI spans

Axiom AI SDK provides flexible redaction policies to control what data is captured in OpenTelemetry spans. This allows you to balance observability needs with privacy and compliance requirements.

Built-in redaction policies

Axiom AI SDK provides two built-in redaction policies:

PolicyWhat gets capturedWhat gets excludedWhen to use
AxiomDefaultFull data–Full observability
OpenTelemetryDefaultModel metadata, token usage, error infoPrompt text, AI responses, tool args and resultsPrivacy-first

If you don’t specify a redaction policy, Axiom AI SDK applies AxiomDefault.

To determine which redaction policy fits your needs, see the following comparison:

AxiomDefault policy

By default, Axiom AI SDK captures all data for maximum observability.

What gets captured:

  • Full prompt text and AI responses in chat spans
  • Complete tool arguments and return values on tool spans
  • All standard OpenTelemetry attributes (model name, token usage, etc.)
Info

Capturing full message content increases span size and storage costs.

When to use:

  • You need full visibility into AI interactions
  • Data privacy isn’t a concern
  • Debugging complex AI workflows

OpenTelemetryDefault policy

The OpenTelemetry default policy excludes sensitive content.

What gets captured:

  • Model metadata (name, provider, version)
  • Token usage and performance metrics
  • Error information and status codes

What gets excluded:

  • Prompt text and AI responses
  • Tool arguments and return values

When to use:

  • Handling sensitive or personal data
  • Compliance requirements restrict data capture
  • You only need performance and error metrics

What gets captured

To determine which redaction policy fits your needs, see the following examples about what gets captured with each defaultpolicy:

JSON
{
  "gen_ai.operation.name": "chat",
  "gen_ai.request.model": "gpt-4o-mini",
  "gen_ai.input.messages": "[{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"Hello, how are you?\"}]}]",
  "gen_ai.output.messages": "[{\"role\":\"assistant\",\"content\":\"I'm doing well, thank you for asking!\"}]",
  "gen_ai.usage.input_tokens": 12,
  "gen_ai.usage.output_tokens": 15,
  "gen_ai.usage.total_tokens": 27
}
JSON
{
  "gen_ai.tool.name": "weather_lookup",
  "gen_ai.tool.description": "Get current weather for a location",
  "gen_ai.tool.arguments": "{\"location\":\"San Francisco\",\"units\":\"celsius\"}",
  "gen_ai.tool.message": "{\"temperature\":18,\"condition\":\"partly cloudy\"}"
}
JSON
{
  "gen_ai.operation.name": "chat",
  "gen_ai.request.model": "gpt-4o-mini",
  "gen_ai.usage.input_tokens": 12,
  "gen_ai.usage.output_tokens": 15,
  "gen_ai.usage.total_tokens": 27
}
Info

Message content (gen_ai.input.messages and gen_ai.output.messages) is excluded for privacy.

JSON
{
  "gen_ai.tool.name": "weather_lookup",
  "gen_ai.tool.description": "Get current weather for a location"
}
Info

Tool arguments and results (gen_ai.tool.arguments and gen_ai.tool.message) are excluded for privacy.

Global configuration

Set a default redaction policy for your entire app using initAxiomAI:

typescript
import { trace } from '@opentelemetry/api';
import { initAxiomAI, RedactionPolicy } from 'axiom/ai';

const tracer = trace.getTracer("my-tracer");

initAxiomAI({ tracer, redactionPolicy: RedactionPolicy.AxiomDefault });
typescript
import { trace } from '@opentelemetry/api';
import { initAxiomAI, RedactionPolicy } from 'axiom/ai';

const tracer = trace.getTracer("my-tracer");

initAxiomAI({ tracer, redactionPolicy: RedactionPolicy.OpenTelemetryDefault });
Info

initAxiomAI is called in your instrumentation file (/src/instrumentation.ts). For setup instructions, see Instrumentation with Axiom AI SDK.

Per-operation override

You can configure different policies for each operation. Axiom resolves redaction policies in the following order (from highest to lowest precedence):

  1. Per-operation policy
  2. Global policy
  3. Default policy

Override the global or default policy for specific operations by passing a redactionPolicy to withSpan:

typescript
import { withSpan, RedactionPolicy } from 'axiom/ai';
import { generateText } from 'ai';

const result = await withSpan(
  { capability: 'customer_support', step: 'handle_sensitive_query' },
  async (span) => {
    span.setAttribute('user.id', userId);
    return generateText({
      model: wrappedModel,
      prompt: 'Process this sensitive customer data...'
    });
  },
  { redactionPolicy: RedactionPolicy.OpenTelemetryDefault }
);

Custom redaction policies

Create custom policies by defining an AxiomAIRedactionPolicy object:

typescript
import { trace } from '@opentelemetry/api';
import { initAxiomAI, AxiomAIRedactionPolicy } from 'axiom/ai';

const tracer = trace.getTracer("my-tracer");

// Custom policy: capture messages but not tool payloads
const customPolicy: AxiomAIRedactionPolicy = {
  captureMessageContent: 'full',
  mirrorToolPayloadOnToolSpan: false
};

initAxiomAI({ tracer, redactionPolicy: customPolicy });

The AxiomAIRedactionPolicy object has two properties:

captureMessageContent'full' | 'off'

Controls whether prompt and response text is included in chat spans.

  • 'full': Include complete message content
  • 'off': Exclude all message content
mirrorToolPayloadOnToolSpanboolean

Controls whether tool arguments and results are duplicated on tool spans.

  • true: Mirror tool data for easier querying
  • false: Only capture tool metadata (name, description)

The built-in policies configure the AxiomAIRedactionPolicy object in the following way:

Default policycaptureMessageContentmirrorToolPayloadOnToolSpan
AxiomDefault'full'true
OpenTelemetryDefault'off'false

Related documentation

Axiom AI SDK instrumentation

Learn how to instrument your AI applications with Axiom AI SDK

OpenTelemetry attributes

Understand the OpenTelemetry attributes captured by Axiom AI SDK

Was this page helpful?
Suggest edits on GitHub
PreviousGenerative AI attributesNextInterpret Axiom docs with LLMs
On this page
Built-in redaction policiesAxiomDefault policyOpenTelemetryDefault policyWhat gets capturedGlobal configurationPer-operation overrideCustom redaction policiesRelated documentation