Sending AgentCore Telemetry (traces, metrics, logs) to Datadog
Reference design — art of the possible. This document shows the options for getting an Amazon Bedrock AgentCore Runtime agent's traces, metrics, and logs into Datadog over OpenTelemetry, then dives deep into the recommended one. The code here is illustrative and does not reflect the current implementation (which emits traces only). It is a blueprint, not a description of what's deployed.
The three options at a glance
Two facts shape every option:
- AgentCore defaults to CloudWatch. Its managed ADOT pipeline sends all three signals to Amazon CloudWatch unless you set
DISABLE_ADOT_OBSERVABILITY=true, which hands the signals to your own exporters.
- Datadog does not accept raw public OTLP. Unlike an OTLP-native SaaS, Datadog ingests OpenTelemetry through either the Datadog Agent (OTLP mode) or an OTel Collector with the
datadogexporter.

| Path | Signals to Datadog | Notes |
|---|---|---|---|
Option 1 (recommended) | AgentCore → OTel Collector (datadog exporter) → Datadog | traces + metrics + logs | Vendor-neutral instrumentation; Collector is the one place that knows Datadog and the natural home for PII redaction. |
Option 2 | AgentCore → Datadog Agent (OTLP mode) → Datadog | traces + metrics + logs | Fewer moving parts if you already run the Datadog Agent somewhere reachable; slightly less vendor-neutral. |
Option 3 | AgentCore → CloudWatch (unchanged) → Datadog AWS integration | metrics + logs; traces lossy | Zero agent change, but it uses CloudWatch and trace fidelity (X-Ray) is a weak fit for Datadog APM. |
In every option, "all three signals" holds only when the agent emits all three. Strands provides traces by default; metrics and logs require registering two additional providers, shown below. The remainder of this document details Option 1.
Option 1 — deep dive: the architecture

The agent registers three OpenTelemetry providers — one per signal — each with an OTLP exporter pointed at an OTel Collector. The Collector receives all three signals, applies central processing (batching, PII redaction, normalization), and its
datadog exporter forwards traces, metrics, and logs to Datadog, where they correlate by trace_id . Setting DISABLE_ADOT_OBSERVABILITY=true removes AgentCore's managed CloudWatch pipeline so your three exporters own the signals.Configuration (environment variables — no code)
The agent's OTLP exporters resolve their destination from standard env vars; point them at the Collector, not Datadog directly:
DISABLE_ADOT_OBSERVABILITY = trueOTEL_EXPORTER_OTLP_ENDPOINT = http://<collector-host>:4318OTEL_EXPORTER_OTLP_PROTOCOL = http/protobufOTEL_SERVICE_NAME = travel-planner-agentOTEL_RESOURCE_ATTRIBUTES = deployment.environment=prod,service.version=1.0.0Datadog-specific configuration — the API key and the Datadog site — lives only in the Collector, never in the agent. This separation is the purpose of the Collector seam: the agent stays vendor-neutral, and only the Collector knows the destination.
The agent code — three providers
Illustrative. Shows the shape; not wired into the current repo.
1. Traces — TracerProvider (provided by Strands)
For a Strands agent,
StrandsTelemetry registers the tracer provider and reads the same environment variables. Traces require no additional code:from strands.telemetry import StrandsTelemetry
# Registers the global TracerProvider + OTLP span exporter from the env vars.StrandsTelemetry().setup_otlp_exporter()Strands then emits spans automatically for the agent invocation, each event-loop cycle, each model call (with token usage), and each tool call.
2. Metrics — MeterProvider
A metrics pipeline is additional code you register. It exports OTLP metrics — counters and histograms — on an interval:
from opentelemetry import metricsfrom opentelemetry.sdk.metrics import MeterProviderfrom opentelemetry.sdk.metrics.export import PeriodicExportingMetricReaderfrom opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter
# OTLPMetricExporter() with no args reads OTEL_EXPORTER_OTLP_ENDPOINT/HEADERS.reader = PeriodicExportingMetricReader(OTLPMetricExporter())meter_provider = MeterProvider(metric_readers=[reader])metrics.set_meter_provider(meter_provider)meter = metrics.get_meter("travel-planner-agent")
# Define the instruments you care about for an LLM agent:tokens = meter.create_counter("gen_ai.tokens", unit="1", description="input+output tokens per call")tool_calls = meter.create_counter("agent.tool.calls", unit="1", description="tool invocations")agent_latency = meter.create_histogram("agent.latency", unit="ms", description="end-to-end agent latency")
# ...then record them in the agent loop:tokens.add(usage["inputTokens"] + usage["outputTokens"], {"gen_ai.request.model": model_id})tool_calls.add(1, {"tool.name": "get_weather"})agent_latency.record(elapsed_ms)3. Logs — LoggerProvider
An OTLP logs pipeline is also additional code. It bridges Python's standard
logging to OTLP so log records carry trace_id / span_id and land in Datadog Log Management, correlated to the trace:import loggingfrom opentelemetry.sdk._logs import LoggerProvider, LoggingHandlerfrom opentelemetry.sdk._logs.export import BatchLogRecordProcessorfrom opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
logger_provider = LoggerProvider()logger_provider.add_log_record_processor( BatchLogRecordProcessor(OTLPLogExporter()) # reads the same env vars)
# Bridge the std logging module to OTLP; records in an active span are# automatically stamped with trace_id/span_id.handler = LoggingHandler(level=logging.INFO, logger_provider=logger_provider)logging.getLogger().addHandler(handler)log = logging.getLogger("travel-planner-agent")
# ...use normal logging; it flows to Datadog, correlated to the trace:log.info("tool get_weather returned", extra={"tool.name": "get_weather"})The serverless flush (applies to all three)
AgentCore suspends the process when the invocation returns. Force a bounded flush of every provider in a
finally block; otherwise spans, metrics, or logs can be dropped:try: ... # run the agentfinally: for p in (trace.get_tracer_provider(), meter_provider, logger_provider): try: p.force_flush(timeout_millis=5000) except Exception: passThe Collector config — fan three signals into Datadog
The Collector is the only component that knows about Datadog. It uses one receiver, optional processing, and one exporter, wired into three pipelines:
receivers: otlp: protocols: http: { endpoint: 0.0.0.0:4318 } grpc: { endpoint: 0.0.0.0:4317 }
processors: batch: {} # Central PII redaction — the main reason to run a Collector for agent data, # since spans/logs carry prompts and completions. redaction: allow_all_keys: true blocked_values: - "[0-9]{3}-[0-9]{2}-[0-9]{4}" # SSN-like - "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+" # emails
exporters: datadog: api: key: ${env:DD_API_KEY} site: datadoghq.com # or datadoghq.eu, etc.
service: pipelines: traces: receivers: [otlp] processors: [redaction, batch] exporters: [datadog] metrics: receivers: [otlp] processors: [batch] exporters: [datadog] logs: receivers: [otlp] processors: [redaction, batch] exporters: [datadog]What you get in Datadog
- APM — the agent trace waterfall (agent loop, model calls, tool calls), GenAI-aware (model id, token usage) via Datadog's OTel GenAI support.
- Metrics — token, latency, and tool-call series for dashboards, SLOs, and alerting independent of individual traces.
- Log Management — agent log events, each linked to its
trace_id/span_idso you can pivot from a log line to the exact trace and span.
All three correlated by
trace_id — the full "integrated observability" picture, in Datadog.The one design constraint to resolve
AgentCore Runtime is managed and runs outside your VPC, so the agent must be able to reach the Collector's OTLP endpoint. Place the Collector where AgentCore can egress to it — a networked Collector behind a secured, authenticated endpoint — without introducing an open public ingress. This reachability decision is the one item to resolve in Option 1; everything else is standard OTEL plus a Collector configuration.
Summary
- Collector → Datadog: the
datadogexporter supports all three signals natively.
- Agent → Collector: all three signals flow only when the agent registers all three providers. Strands provides traces; metrics and logs are the additional code shown above.
- Configuration is standard
OTEL_*environment variables. Datadog specifics and PII redaction belong in the Collector.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article