RousselTMLEARNING

Observability

AI Observability in Dynatrace

Observing generative AI applications with Dynatrace: OpenTelemetry instrumentation (OpenLLMetry), GenAI conventions, tracking tokens, costs and latency, RAG chains and agents, quality and guardrails, prompt privacy.

1. Why observe an AI application? #

New risks to measure.

The stakes #

Good to know : Dynatrace SaaS, third-generation platform (Grail, AppEngine). The apps mentioned are in the app launcher; some depend on the licence (Dynatrace Platform Subscription).
  • Cost: each call consumes billed tokens; an overly long prompt or an agent loop can multiply the bill.
  • Latency: a model answers in seconds; the full chain (retrieval, tools, model) must stay acceptable.
  • Quality: wrong answers, refusals, hallucinations or inappropriate content trigger no HTTP error.
  • Compliance: prompts and answers may contain personal data.
AI Observability

Layers to observe #

Observing an AI application

2. Instrumenting #

OpenTelemetry and GenAI conventions.

With OpenLLMetry #

# Instrument a Python AI application with OpenLLMetry (OpenTelemetry for LLMs)
# pip install traceloop-sdk
import os
from traceloop.sdk import Traceloop

Traceloop.init(
    app_name="assistant-support",
    api_endpoint="https://<environment>.live.dynatrace.com/api/v2/otlp",
    headers={"Authorization": f"Api-Token {os.environ['DT_API_TOKEN']}"},   # scopes openTelemetryTrace.ingest, metrics.ingest
    disable_batch=False,
)
# OpenAI, Bedrock, LangChain… calls are then traced automatically

OpenLLMetry (Traceloop) extends OpenTelemetry to AI libraries (OpenAI, Anthropic, Amazon Bedrock, Azure OpenAI, LangChain, LlamaIndex, vector databases) and sends traces and metrics over OTLP to Dynatrace. OneAgent complements with classic services, hosts and dependencies.

Useful attributes #

AttributeContent
gen_ai.systemprovider (openai, anthropic, aws.bedrock…)
gen_ai.request.modelrequested model
gen_ai.usage.input_tokens / output_tokenstokens consumed
gen_ai.response.finish_reasonsnormal end, max length, content filter
Good to know : OpenTelemetry GenAI semantic conventions are still evolving: check the attribute names produced by your library version.

3. Analyzing #

Cost, latency, quality.

DQL queries #

// Tokens and latency per model over 24 h (OpenTelemetry GenAI semantic conventions)
fetch spans, from: now() - 24h
| filter isNotNull(gen_ai.request.model)
| summarize calls = count(),
            input_tokens = sum(gen_ai.usage.input_tokens),
            output_tokens = sum(gen_ai.usage.output_tokens),
            p95 = percentile(duration, 95),
            by: { gen_ai.request.model }
| sort output_tokens desc
  • Cost: multiply tokens by the model price (lookup table) for a cost dashboard per team or feature.
  • RAG: compare retrieval time (vector database) and generation time; poor recall shows as longer answers and retries.
  • Agents: count tool calls per request; a sudden rise signals a loop.

Quality and guardrails #

  • Record evaluations (user rating, LLM judge, toxicity detection) as attributes or events, to track quality over time.
  • Alert on refusals and filtered answers (finish_reasons), and on hourly cost.
  • Link a quality drop to a model or prompt change thanks to the version in resource attributes.

4. Privacy #

Prompts and answers are data.

Rules #

  • Disable prompt content capture in production if not needed (instrumentation library option).
  • Otherwise, mask at ingestion (OpenPipeline masking rules) addresses, numbers and identifiers.
  • Restrict access to AI spans with security policies (sensitive fields, dedicated buckets).
Watch out : A prompt may contain anything the user typed: treat AI traces as personal data under the GDPR.

Commands to know #

Commands to know
  • Traceloop.init(api_endpoint=".../api/v2/otlp") : send AI traces to Dynatrace
  • fetch spans | filter isNotNull(gen_ai.request.model) : model call spans
  • sum(gen_ai.usage.output_tokens) : output tokens
  • Authorization: Api-Token <jeton> : OTLP ingest header

Sources #

Based on the official Dynatrace documentation checked in November 2026: platform apps change every month, check labels, permissions and field names in your environment before relying on a detail.

Related articles

Time-based vs event-based SLO: understanding, computing and choosing (with the Qonto example)

Differences between time-based SLOs (time slices, uptime) and event-based SLOs (good events over total): defi…

The observability trilemma: cost, completeness and performance, and how solutions resolve it

Understanding the observability trilemma (cost, data completeness, query performance), its three trade-offs, …

Accessing the Dynatrace playground and getting started

The Dynatrace playground is a demo environment full of real data: how to access it, what it allows and does n…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!