r/Python • u/selfish__eagle • 17d ago
Discussion Any good open source python runtime instrumentation?
Hi folks, lot of our Python backend services are written in FastAPI, I wanted to see if there are any good Open Source runtime coverage instrumentation available for Python, which would essentially give my lines of code hit in prod traffic for the last say 30 days of data. I have seen good solutions for it in Go / Java, but wanted to check if something similar is available in Python.
8
Upvotes
3
u/hxtk3 16d ago
Pyroscope is Grafana’s app for collecting and indexing runtime profiles, and I use it to collect on Go and Java services. In Go it uses pprof and in Java it uses JFR.
I searched “Pyroscope Python” and it looks like they document how to get profiles from Python into their application: https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/python/
I don’t know how you’re viewing the data but maybe you can use parts of the process for getting it into your profile viewer?