Published
Datadog LLM Observability Costs: OpenTelemetry gen_ai Filtering and Routing
Control AI trace content, span volume and billing separately, with a metadata allowlist, signal reconciliation and a reversible OTel gateway pilot.
The first cost question for LLM traces is which billed meter increased. Prompt bytes, accepted spans, indexed traces, evaluations, custom metrics and retention are different quantities. Removing a large prompt attribute may improve data handling without reducing a span-based invoice at all. Start with the contract and a matched usage export.
Establish the supported ingestion path
Datadog’s OpenTelemetry instrumentation guide describes supported GenAI and OpenInference conventions for its Agent Observability product, commonly searched as LLM Observability. Check your SDK, Collector, site and exporter versions together. A trace reaching an OTLP endpoint does not establish that it has the attributes needed for the intended product or that it avoids a second APM ingestion path.
Capture one controlled conversation with a synthetic marker in every possible content location. Inspect attributes, events, resource attributes, status messages, tool arguments and tool results at each destination. A policy that deletes only gen_ai.prompt is not a complete content-removal policy; conventions and instrumentation versions differ.
| Quantity | Evidence to collect | Candidate action |
|---|---|---|
| Accepted LLM spans | Product usage export and producer count | Remove duplicate instrumentation; review trace sampling |
| Content bytes | Synthetic payload at every destination | Disable source capture; reconstruct allowed metadata |
| Evaluations | Evaluation configuration and measured executions | Scope the approved evaluation population |
| Metric series | Dimension set and active-series counts | Aggregate trusted low-cardinality dimensions |
| Retained content | Store inventory and retention/access policy | Reduce approved retention or stop unnecessary copying |
Put collection policy before export
Prefer disabling prompt and completion capture in the application instrumentation. At the gateway, build an allowlist for model identity, operation, bounded status, duration, token categories and trusted ownership. Keep trace linkage and the convention attributes required by the selected ingestion path. Test the policy with that exact exporter instead of copying a universal OTTL snippet that assumes every library stores messages in the same fields.
The following is a review specification for a pilot, not Collector configuration:
{
"synthetic": true,
"destination": "approved-llm-metadata-pipeline",
"keep": ["trace_id", "span_id", "parent_span_id", "duration_ms",
"operation", "model", "input_tokens", "output_tokens",
"bounded_error_class", "trusted_team"],
"reject_from_metadata_export": ["messages", "tool_arguments",
"tool_results", "free_text_errors"],
"checks": ["no_synthetic_content_marker", "token_totals_reconcile",
"errors_remain_visible", "trace_parentage_retained"]
}
Translate this specification into your pinned processor configuration and fixture tests. The semantic fields above are an internal schema, not a claim that they are literal OTel attribute names. Validate events and nested fields as well as ordinary attributes. Unknown instrumentation should enter a quarantine or explicit policy failure, rather than silently bypassing the allowlist.
Preserve metrics before reducing traces
Dropping a trace does not produce token, error or latency metrics. Emit or aggregate those signals independently before applying the approved trace-sampling policy. Define error and latency objectives and compare counters against the application/provider record for the same requests. A sample containing only successful short requests can make the cost chart look better while hiding the incidents the team bought observability to diagnose.
Keep user_id, arbitrary session IDs, prompts and document identifiers out of ordinary metric dimensions. Keep a restricted correlation route only when the incident process requires it. Record the sample policy so an analyst knows whether a count is exact, estimated or limited to retained traces. Check Collector queue pressure and dropped telemetry: an exporter outage is not a saving.
Archive only approved content
S3 or ClickHouse is a separate data system with its own access, encryption, retention, deletion and query obligations. Do not create a raw-prompt archive simply because it is cheaper than trace storage. If a documented use requires content, use a separate restricted route and redact at the producer before copying. Verify that the Datadog/APM destinations do not still receive the unredacted copy.
Run a small reversible pilot across a matched workload. Report the change in each billed meter, total ownership cost, incident-query results and content-marker tests. Retain rollback configuration and an owner for failed exports. Read the Bedrock S3 invocation-logging guide when the provider log itself is the source.
The $3,500 telemetry audit can scope one AI collection path within the existing source/account limits. The deliverable is a measured baseline and reviewed pilot, with no guaranteed percentage reduction.
Frequently asked questions
Does deleting prompts lower every Datadog LLM bill?
No. Content bytes, span counts, indexed usage and evaluations are separate meters. Reconcile the actual contract and usage export before projecting savings.
Can a gateway guarantee prompt removal by deleting two attributes?
No. Content may appear in events, nested attributes, errors and tool fields. Disable capture at the source and test the complete supported ingestion path with synthetic markers.
Does trace sampling preserve token and error totals automatically?
No. Emit or aggregate the required metrics independently and reconcile them before changing trace retention or sampling.
Continue reading
- Bedrock in FedRAMP and NIST 800-53 Environments: Guardrails and Audit Evidence
Map Bedrock network, identity, Guardrails and logging evidence to owned NIST controls, with authorized-scope checks and negative fixtures.
- Bedrock Knowledge Base Costs: OpenSearch Serverless OCUs vs Aurora pgvector
Compare classic and NextGen OpenSearch capacity with Aurora pgvector, then stage a Bedrock knowledge-base migration with retrieval and rollback checks.
- Bedrock Model Invocation Logging: Direct S3, Athena and CloudWatch Cost Boundaries
Use a reviewed S3-only Bedrock invocation-log route, verify endpoint coverage and build an auditable Athena pipeline without assuming universal CloudWatch rates.
Written by
Tymur Chmeruk
Cloud Security & Infrastructure Engineer · Baltimore–Washington Metro · [email protected]