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.
Layers to observe #
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 automaticallyOpenLLMetry (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 #
| Attribute | Content |
|---|---|
gen_ai.system | provider (openai, anthropic, aws.bedrock…) |
gen_ai.request.model | requested model |
gen_ai.usage.input_tokens / output_tokens | tokens consumed |
gen_ai.response.finish_reasons | normal 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 Dynatracefetch spans | filter isNotNull(gen_ai.request.model): model call spanssum(gen_ai.usage.output_tokens): output tokensAuthorization: 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.
