Skip to main content

Overview

Datadog LLM Observability dashboard
The Datadog plugin provides native integration with the Datadog observability platform, offering three pillars of observability for your LLM operations:
  • APM Traces - Distributed tracing via dd-trace-go v2 with W3C Trace Context support for end-to-end request visibility
  • LLM Observability - Native Datadog LLM Obs integration for AI/ML-specific monitoring
  • Metrics - Operational metrics via DogStatsD or the Metrics API
Unlike the OTel plugin which sends generic OpenTelemetry data, the Datadog plugin leverages Datadog’s native SDKs for richer integration with Datadog-specific features like LLM Observability dashboards and ML App grouping.

Deployment Modes

Datadog LLM Observability dashboard
The plugin supports two deployment modes:
ModeDescriptionRequirementsBest For
Agent (default)Sends data through a local Datadog AgentDatadog Agent running on hostProduction deployments with existing agent infrastructure
AgentlessSends data directly to Datadog APIsAPI key onlyServerless, containers, or simplified deployments

Agent Mode

In agent mode, the plugin communicates with a locally running Datadog Agent:
  • APM Traces → Agent at localhost:8126
  • Metrics → DogStatsD at localhost:8125
The agent handles batching, retries, and provides lower latency. This is the recommended mode for production deployments where you already have the Datadog Agent installed.

Agentless Mode

In agentless mode, the plugin sends data directly to Datadog’s intake APIs ({site} is your configured Datadog site, e.g. datadoghq.com):
  • LLM Observabilityhttps://api.{site}/api/intake/llm-obs/v1/trace/spans
  • Metricshttps://api.{site} Metrics API (series to /api/v2/series, distributions to /api/v1/distribution_points)
This mode requires an API key but simplifies deployment by eliminating the need for a local agent. Ideal for serverless environments, Kubernetes pods, or quick testing.
Datadog officially supports agentless submission for LLM Observability and metrics, but not for general APM tracing - the dd-trace-go setup assumes a running Agent (or the serverless extension). The plugin points the tracer at the public trace intake so APM spans are still emitted, but if you need fully-supported APM, run the Datadog Agent (agent mode). LLM Observability and metrics are unaffected.

Configuration

Required Fields

FieldTypeRequiredDefaultDescription
service_namestringNobifrostService name displayed in Datadog APM
ml_appstringNo(uses service_name)ML application name for LLM Observability grouping
agent_addrstringNolocalhost:8126Datadog Agent address as combined host:port (agent mode only, supports env.VAR_NAME). Overridden by agent_host when set
agent_hoststringNo-Datadog Agent host, set separately from the port (agent mode only, supports env.VAR_NAME). Takes precedence over agent_addr
agent_portstringNo8126Datadog Agent port, used with agent_host (agent mode only, supports env.VAR_NAME)
dogstatsd_addrstringNolocalhost:8125DogStatsD server address as combined host:port (agent mode only, supports env.VAR_NAME). Overridden by dogstatsd_host when set
dogstatsd_hoststringNo-DogStatsD server host, set separately from the port (agent mode only, supports env.VAR_NAME). Takes precedence over dogstatsd_addr
dogstatsd_portstringNo8125DogStatsD server port, used with dogstatsd_host (agent mode only, supports env.VAR_NAME)
envstringNo-Environment tag (e.g., production, staging)
versionstringNo-Service version tag
custom_tagsobjectNo-Additional tags for all traces and metrics
enable_metricsboolNotrueEnable metrics emission
enable_tracesboolNotrueEnable APM traces
enable_llm_obsboolNotrueEnable LLM Observability
group_traces_by_sessionboolNofalseGroup requests sharing the same x-bf-session-id into one APM trace (agent mode only). See Grouping APM Traces by Session
agentlessboolNofalseUse agentless mode (direct API)
api_keystringAgentless only-Datadog API key (supports env.VAR_NAME)
sitestringNodatadoghq.comDatadog site/region

Environment Variable Substitution

The api_key, agent_addr, agent_host, agent_port, dogstatsd_addr, dogstatsd_host, dogstatsd_port, and custom_tags fields support environment variable substitution using the env. prefix:
{
  "api_key": "env.DD_API_KEY",
  "agent_addr": "env.DD_AGENT_ADDR",
  "dogstatsd_addr": "env.DD_DOGSTATSD_ADDR",
  "custom_tags": {
    "team": "env.TEAM_NAME",
    "cost_center": "env.COST_CENTER"
  }
}
Substitution is whole-value only"env.DD_HOST:8125" does not work, because the entire field is treated as one variable reference. If your environment exposes the agent host and port as separate variables (common in Kubernetes, where the host is injected from the downward API status.hostIP and the port is fixed), use the separate agent_host / agent_port and dogstatsd_host / dogstatsd_port fields instead of agent_addr / dogstatsd_addr. When a *_host field is set it takes precedence over the combined *_addr, and the matching *_port defaults to 8126 (agent) / 8125 (DogStatsD).

Separate host and port (Kubernetes)

{
  "dogstatsd_host": "env.DD_AGENT_HOST",
  "agent_host": "env.DD_AGENT_HOST"
}
The ports are omitted here because they default to 8126 (agent) and 8125 (DogStatsD). Set agent_port / dogstatsd_port (literal or env. reference) only if your agent listens on non-standard ports. With the Kubernetes downward API injecting the node IP:
env:
  - name: DD_AGENT_HOST
    valueFrom:
      fieldRef:
        fieldPath: status.hostIP

Setup

Datadog LLM Observability dashboard
Configure the Datadog plugin through the Bifrost UI:
  1. Navigate to Plugins
  2. Enable the Datadog plugin
  3. Configure the required fields based on your deployment mode

Datadog Sites

The plugin supports all Datadog regional sites. Set the site field to match your Datadog account region:
SiteRegionValue
US1 (default)United Statesdatadoghq.com
US3United Statesus3.datadoghq.com
US5United Statesus5.datadoghq.com
EU1Europedatadoghq.eu
AP1Asia Pacific (Japan)ap1.datadoghq.com
AP2Asia Pacific (Australia)ap2.datadoghq.com
US1-FEDUS Governmentddog-gov.com
US2-FEDUS Governmentus2.ddog-gov.com
Ensure your API key corresponds to the selected site. API keys from one region will not work with another.

LLM Observability

Datadog LLM Observability dashboard
The Datadog plugin integrates with Datadog LLM Observability to provide AI/ML-specific monitoring capabilities.

ML App Grouping

LLM traces are grouped under an ML App in Datadog. By default, this uses your service_name, but you can specify a dedicated ML App name:
{
  "service_name": "bifrost-gateway",
  "ml_app": "customer-support-ai"
}
This allows you to:
  • Group related LLM operations across multiple services
  • Track costs and performance by application
  • Apply ML-specific alerts and dashboards

Session Tracking

The plugin supports session tracking via the x-bf-session-id header. Include this header in your requests to group related LLM calls into a conversation session:
curl -X POST https://your-bifrost-gateway/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "x-bf-session-id: user-123-session-456" \
  -d '{...}'
Sessions appear in Datadog LLM Observability, allowing you to trace entire conversation flows.

Grouping APM Traces by Session

By default, every request is its own APM trace, so a multi-turn conversation appears as many separate traces in the APM trace view. (Cross-trace grouping normally lives in LLM Observability sessions, a separate product from APM.) Enable group_traces_by_session to instead group every request sharing the same x-bf-session-id into a single APM trace, where each request renders as a top-level sibling span:
{
  "group_traces_by_session": true
}
# Both requests below land in the same APM trace
curl ... -H "x-bf-session-id: user-123-session-456" -d '{...}'
curl ... -H "x-bf-session-id: user-123-session-456" -d '{...}'
Bifrost derives a stable Datadog trace ID from the x-bf-session-id value, so all requests carrying that header resolve to the same trace.
  • Agent mode only. APM spans are emitted only in agent mode. In agentless mode the plugin emits LLM Observability spans only, which already group via session tracking.
  • W3C traceparent takes precedence. If a request carries an inbound traceparent header, it stays on that distributed trace and is not regrouped by session.
  • APM traces are not built for long-lived sessions. Datadog has practical limits on spans-per-trace and trace-assembly windows; very long sessions may render with large time gaps or be truncated. For long conversations, prefer LLM Observability sessions.

W3C Distributed Tracing

The plugin supports W3C Trace Context for distributed tracing across services. When your upstream service sends a traceparent header, Bifrost automatically links its spans as children of the parent trace.
curl -X POST https://your-bifrost-gateway/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01" \
  -d '{...}'
This enables:
  • End-to-end visibility - See LLM calls in the context of your full application trace
  • Cross-service correlation - Link frontend requests → backend services → Bifrost → LLM providers
  • Latency attribution - Understand how LLM latency contributes to overall request time
The traceparent header format follows the W3C standard:
traceparent: {version}-{trace-id}-{parent-id}-{trace-flags}
All Datadog APM spans created by Bifrost will be linked to the parent span, appearing as children in the Datadog trace view.

What’s Captured

For each LLM operation, the plugin sends to LLM Observability:
  • Input/Output Messages - Full conversation history with role attribution
  • Token Usage - Input, output, and total token counts
  • Cost - Calculated cost in USD based on model pricing
  • Latency - Request duration and time-to-first-token for streaming
  • Model Info - Provider, model name, and request parameters
  • Tool Calls - Function/tool call details for agentic workflows

Metrics Reference

The plugin emits the following metrics to Datadog:
MetricTypeDescriptionTags
bifrost.requests.totalCounterTotal LLM requestsprovider, model, method
bifrost.success.totalCounterSuccessful requestsprovider, model, method
bifrost.errors.totalCounterFailed requestsprovider, model, method, reason
bifrost.latency.secondsHistogramRequest latency distributionprovider, model, method
bifrost.tokens.inputCounterInput/prompt tokens consumedprovider, model
bifrost.tokens.outputCounterOutput/completion tokens generatedprovider, model
bifrost.tokens.totalCounterTotal tokens (input + output)provider, model
bifrost.request.cost.usdDistributionPer-request cost in USDprovider, model
bifrost.cache.hitsCounterCache hitsprovider, model, cache_type
bifrost.stream.first_token_latencyHistogramTime to first token (streaming)provider, model
bifrost.stream.inter_token_latencyHistogramInter-token latency (streaming)provider, model

Migrating from bifrost.cost.usd

The cost metric was renamed from bifrost.cost.usd to bifrost.request.cost.usd, and its type changed from Gauge to Distribution. The gauge was last-write-wins per flush window, so concurrent requests with the same tags collapsed to a single value and no query could recover the true total spend. The new name is required because Datadog permanently associates a metric name with its first-seen type per organization — orgs that previously received the gauge cannot receive the same name as a distribution. Affected assets: any dashboards, monitors, saved views, or alerts that query bifrost.cost.usd. To migrate:
  1. Replace bifrost.cost.usd with bifrost.request.cost.usd in all queries.
  2. Update aggregations for Distribution semantics — each sample is one request’s cost:
    • Total spend: sum:bifrost.request.cost.usd{*} (do not append .as_count() or .rollup(sum); the sum: aggregator already returns the additive total)
    • Per-request statistics: avg:, max:, or percentile aggregators
  3. Recreate monitors and alerts on the new metric, adjusting thresholds if they assumed gauge behavior (the gauge systematically under-reported under concurrent load).
bifrost.cost.usd stops receiving data once the upgrade completes; during a rolling deploy both metrics receive data, so update dashboards at or shortly after the upgrade. Historical gauge data remains queryable under the old name for Datadog’s standard retention window.

Custom Tags

All metrics include your configured custom_tags plus automatic tags for:
  • provider - LLM provider (openai, anthropic, etc.)
  • model - Model name
  • method - Type of request (chat, embedding, etc.)
  • bifrost_node - Per-instance identity (BIFROST_NODE_ID if set, otherwise hostname-pid)
  • plus Bifrost-context tags when available (virtual key, selected key, team, customer, fallback index)

Captured Data

Each APM trace includes comprehensive LLM operation metadata:

Span Attributes

  • Span Name - Based on request type (genai.chat, genai.embedding, etc.)
  • Service Info - service.name, service.version, env (Datadog’s unified service tagging: service, version, env)
  • Provider & Model - gen_ai.provider.name, gen_ai.request.model

Request Parameters

  • Temperature, max_tokens, top_p, stop sequences
  • Presence/frequency penalties
  • Tool configurations and parallel tool calls
  • Custom parameters via ExtraParams

Input/Output Data

  • Complete chat history with role-based messages
  • Prompt text for completions
  • Response content with role attribution
  • Tool calls and results
  • Reasoning and refusal content (when present)

Performance Metrics

  • Token usage (prompt, completion, total)
  • Cost calculations in USD
  • Latency and timing (start/end timestamps)
  • Time to first token (streaming)
  • Error details with status codes

Bifrost Context

  • Virtual key ID and name
  • Selected key ID and name
  • Team ID and name
  • Customer ID and name
  • Retry count and fallback index

Plugin Span Filtering

By default every plugin’s pre- and post-hook execution generates a span, which can bloat APM traces when many plugins are active (e.g. 8 built-in plugins × 2 hooks = 16 plugin spans per request). Use plugin_span_filter inside the Datadog plugin config to control which plugin spans are exported. This affects only the exported APM trace spans — plugin execution and metrics are unchanged. Via config.json (inside the Datadog plugin config):
{
  "plugins": [
    {
      "name": "datadog",
      "enabled": true,
      "config": {
        "service_name": "bifrost",
        "agent_addr": "localhost:8126",
        "enable_traces": true,
        "plugin_span_filter": {
          "mode": "exclude",
          "plugins": ["logging", "compat", "telemetry"]
        }
      }
    }
  ]
}
Via the UI: Open the Observability page, select the Datadog connector, and click Configure Plugin Tracing. Toggle individual plugins on or off and save. UI-saved settings persist across restarts unless plugin_span_filter is set in config.json with a higher version value. Filter modes:
ModeBehaviour
excludeExport spans for all plugins except those listed
includeExport spans only for the listed plugins
Plugin names: list each plugin using the exact name shown for it in the Configure Plugin Tracing sheet — this is the same name that appears in the span (plugin.<name>.<stage>), and it is what the filter matches against. Note that some plugins are registered under a different name than their config key: the enterprise prompts and governance plugins appear as enterprise-prompts and enterprise-governance (not prompts/governance). Common names include telemetry, logging, otel, semantic_cache, compat, maxim, enterprise-prompts, enterprise-governance, datadog, bigquery, guardrails, adaptive-loadbalancer, and model-catalog-resolver. The exact set depends on which plugins are loaded in your deployment. When a plugin span is filtered out, its children are automatically re-parented to the nearest exported ancestor so the trace hierarchy stays connected. The filter applies to APM trace spans only; it does not change DogStatsD metrics, which are never derived from plugin spans.
Each observability connector has its own independent plugin_span_filter — filtering plugin spans for Datadog does not affect OTEL, BigQuery, or any other connector. plugin_span_filter follows the standard plugin config precedence rules; to make a config.json value override UI-saved DB settings on restart, set a higher version on the Datadog plugin entry (e.g. "version": 2). See Plugin Versioning for details.

Supported Request Types

The Datadog plugin captures all Bifrost request types:
Request TypeSpan NameLLM Obs Type
Chat Completiongenai.chatLLM Span
Chat Completion (streaming)genai.chatLLM Span
Text Completiongenai.textLLM Span
Text Completion (streaming)genai.textLLM Span
Embeddingsgenai.embeddingEmbedding Span
Speech Generationgenai.speechTask Span
Speech Generation (streaming)genai.speechTask Span
Transcriptiongenai.transcriptionTask Span
Transcription (streaming)genai.transcriptionTask Span
Responses APIgenai.responsesLLM Span
Responses API (streaming)genai.responsesLLM Span

When to Use

Datadog Plugin

Choose the Datadog plugin when you:
  • Use Datadog as your primary observability platform
  • Want native LLM Observability integration with ML App grouping
  • Need seamless correlation with existing Datadog APM traces via W3C distributed tracing
  • Require Datadog-specific features like notebooks and dashboards
  • Want session tracking for conversation flows

vs. OTel Plugin

Use the OTel plugin when you:
  • Need multi-vendor observability (send to multiple backends)
  • Are using Datadog via an OpenTelemetry Collector
  • Want vendor flexibility to switch backends without code changes
  • Prefer standardized OpenTelemetry semantic conventions
You can use both plugins simultaneously if needed. The Datadog plugin provides native integration while OTel can send to additional backends.

vs. Built-in Observability

Use Built-in Observability for:
  • Local development and testing
  • Simple self-hosted deployments
  • No external dependencies required
  • Direct database access to logs

Troubleshooting

Agent Connectivity Issues

Verify the Datadog Agent is running and accessible:
# Check agent status
datadog-agent status

# Test APM endpoint
curl -v http://localhost:8126/info

# Test DogStatsD (should accept UDP packets)
echo "test.metric:1|c" | nc -u -w1 localhost 8125

Agentless Mode Not Working

  1. Verify your API key is valid:
curl -X GET "https://api.datadoghq.com/api/v1/validate" \
  -H "DD-API-KEY: $DD_API_KEY"
  1. Ensure the site matches your API key’s region
  2. Check that the API key environment variable is set:
echo $DD_API_KEY

Missing Traces

  1. Enable debug logging in Bifrost:
bifrost-http --log-level debug
  1. Verify traces are enabled in your configuration:
{
  "enable_traces": true,
  "enable_llm_obs": true
}
  1. Check for errors in the Bifrost logs related to the Datadog plugin

Missing Metrics

  1. Verify DogStatsD is running (agent mode):
datadog-agent status | grep DogStatsD
  1. Ensure metrics are enabled:
{
  "enable_metrics": true
}
  1. For agentless mode, verify your API key has metrics submission permissions

LLM Observability Not Appearing

  1. LLM Observability requires enable_llm_obs: true (default)
  2. Verify your Datadog plan includes LLM Observability
  3. Check the ML App name in Datadog under LLM ObservabilityApplications

Next Steps