prometheus / prometheus/client_python
Timing generator function
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 4.4k
- Fork
- 876
- Merge medio
- 8g 4h
- PR unite (30g)
- 1
Descrizione
Is there any way to time how long it takes to execute a generator function in python with Histogram.time? Right now, it only seems to measure the time to get the generator object. But since generators do lazy computation while actually iterating over it, we don't get full time.
Example:
def generate_n(n):
for i in range(n):
yield i
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Start by reading the Histogram.time entry point and tracing how it handles the generator example in the issue. Define what timing the full lazy iteration should mean, then add coverage showing that the measured duration includes generator execution rather than only creation.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- observability
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100