trallnag / prometheus-fastapi-instrumentator

Instrument your FastAPI with Prometheus metrics.
ISC License
948 stars 84 forks source link

fix: Fix info.response.body empty with normal responses #237

Closed trallnag closed 1 year ago

trallnag commented 1 year ago

What does this do?

Fixes problem where in instrumentation functions info.response.body is empty if response is just a response (not being streamed).

Also adds tests that check this behavior.

Linked issues

Fixes #236

codecov[bot] commented 1 year ago

Codecov Report

Merging #237 (3538fe4) into master (241229b) will increase coverage by 0.29%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #237      +/-   ##
==========================================
+ Coverage   95.29%   95.58%   +0.29%     
==========================================
  Files           5        5              
  Lines         340      340              
==========================================
+ Hits          324      325       +1     
+ Misses         16       15       -1     
Impacted Files Coverage Δ
...rc/prometheus_fastapi_instrumentator/middleware.py 97.75% <100.00%> (+1.12%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.