Menu

OpenTelemetry Python FastAPI: instrument an API for Dynatrace without OneAgent
📰

OpenTelemetry Python FastAPI: instrument an API for Dynatrace without OneAgent

DEV Community: fastapi·Span Observer·6 days ago
#968tK7Dm
Long article (1394 words) — no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.