
-
Choose and initialize an exporter.
OpenTelemetry uses an internal metric model; an exporter converts that model into your backend’s format. A common choice for Prometheus users is the Prometheus exporter, which exposes an HTTP endpoint that Prometheus can scrape. -
Wire the exporter into the OTel metric pipeline.
This configures the MeterProvider (or equivalent) so captured metrics flow to your exporter and metric backend. -
Enable framework instrumentation.
Install and activate the instrumentation package for your framework (for example, FastAPIInstrumentor). The instrumenter intercepts framework-level operations (HTTP requests, DB calls, etc.) and emits standard metrics automatically.
- Records request start time on entry.
- On completion, records response status and computes duration.
- Emits counters and histograms with labels such as
path,method, andstatus_codeso you can slice-and-dice traffic, errors, and latency.
- Your application code remains unchanged: instrumentation runs at the framework level.
- You quickly collect the classic observability signals across many services without touching business logic.
- Once the OTel stack is in place, adding traces or correlated logs is straightforward.

- Use auto-instrumentation for framework and infrastructure signals (HTTP, DB clients, runtimes).
- Use manual instrumentation for domain-specific metrics (orders placed, conversion rate, payment status).
- Combine both approaches: auto-instrumentation provides the baseline golden signals while manual instrumentation captures business semantics.
OpenTelemetry covers metrics, traces, and logs. This guide focuses on metrics, but the same OTel libraries make it simple to add distributed tracing and correlated logging later — adopt OTel now to ease future expansions into tracing and log correlation.

Auto-instrumentation does not replace domain-specific metrics. For metrics tied to business behavior (for example,
orders_created or payment_attempts), add manual instrumentation in your code alongside auto-instrumentation.
Next steps / resources
- Try the hands-on lab that demonstrates Python + FastAPI + OpenTelemetry for auto-instrumentation and shows how to add manual metrics where needed.
- OTel docs: https://opentelemetry.io/
- Prometheus docs: https://prometheus.io/docs/