A FastAPI service that slows down without leaving a trail is an on-call nightmare: the logs say « 200 OK », the users say « it’s slow ». Instrumenting OpenTelemetry Python FastAPI gives you traces, metrics and shared context, without installing OneAgent on the host, which is often impossible on managed containers or serverless platforms.
Goal: by the end of this tutorial, your FastAPI service sends its spans and metrics over OTLP to Dynatrace, directly or through a Collector, and you know how to verify ingestion. It applies to Dynatrace SaaS (Grail storage, DQL queries) and to Dynatrace Managed (the environment’s OTLP endpoint, analysis in the classic screens). Differences are flagged at each step.
If your spans do not show up at the end, keep the troubleshooting guide OpenTelemetry traces not showing in Dynatrace close at hand.
The problem: an opaque Python API
Without instrumentation, a slow request looks like any other. You see neither the 800 ms outbound HTTP call nor the unindexed SQL query.…