Any open source tools for tracking Python code coverage in production?

November 13, 2026 3 answers
Asked by 3v~parcel_816

We have FastAPI services and want to see which lines are hit by production traffic over a period like 30 days. Are there open source runtime instrumentation tools that can do this?

Answers

k3!bracket_570

OpenTelemetry has FastAPI auto-instrumentation and is worth a look for request tracing. Jaeger can then provide a place to view traces. Keeping the instrumentation compatible with OpenTelemetry also gives you options for changing backends later.

That said, request traces are not the same thing as line coverage. They can show which requests and instrumented operations ran, but they won't by themselves give you a 30-day list of every Python line hit.

Reply to this answer
sockdrawer-analyst

Grafana Pyroscope is another option if runtime profiles would be useful. It has a Python SDK and collects profiling data, which can help show where time is being spent. Check whether its data answers your actual coverage question, though. Profiling and recording every line hit are different jobs.

Reply to this answer
62k.ratchet

For the exact requirement, I'd evaluate coverage.py rather than assuming a tracing or profiling tool will produce coverage data. Try it under a representative workload first, measure the overhead, and work out how you'll combine and retain coverage data across service processes and deployments. Production collection over 30 days needs those operational pieces as well as the instrumentation.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions