Make elapsed time available in the `response` event hook

Aperta
#762 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
networking

Direzione di ricerca

Inizia tracciando il ciclo di vita di response event hook e l’implementazione esistente di response.elapsed. Determina dove viene rilevato il tempo della richiesta rispetto agli hook di request e response, quindi verifica che la durata effettiva della richiesta possa essere resa disponibile al response hook senza includere il tempo di elaborazione degli hook.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Originally opened by @joaonc on 2023-05-23 20:12:14 in encode/httpx

There are two types of elapsed time on a response:

  • The current .elapsed that accounts for total time of request, including event hooks. This is what we have now (Related to https://github.com/encode/httpx/issues/655).
  • The elapsed time of the actual request, not taking into account the event hooks, which can take a significant amount of time, depending on what you're doing. This number is currently not available.

In many scenarios, we have request and/or response event hooks that do a time consuming process, but need the time of the actual request only, w/o event hooks. Prime example is logging the response in a response event hook and we want to include the elapsed time in the response.

Is it possible to add a mechanism in which:

  • We can access the elapsed time w/o the time to process event hooks.
  • Have that time available in the response hook.
Lingua principale
Python
Stelle
1.6k
Fork
103
Merge medio
1g 19h
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pydantic/httpx2

Tutte le issue di pydantic/httpx2

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.