Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix regression multi app Prometheus registry #220

Merged
merged 7 commits into from
Mar 8, 2023

Conversation

trallnag
Copy link
Owner

Fixes #219

@codecov
Copy link

codecov bot commented Feb 26, 2023

Codecov Report

Merging #220 (286ca19) into master (a9e21ac) will increase coverage by 0.01%.
The diff coverage is 86.66%.

❗ Current head 286ca19 differs from pull request most recent head feeb044. Consider uploading reports for the commit feeb044 to get more accurate results

@@            Coverage Diff             @@
##           master     #220      +/-   ##
==========================================
+ Coverage   95.72%   95.73%   +0.01%     
==========================================
  Files           5        5              
  Lines         304      305       +1     
==========================================
+ Hits          291      292       +1     
  Misses         13       13              
Impacted Files Coverage Δ
src/prometheus_fastapi_instrumentator/metrics.py 96.52% <84.61%> (ø)
...rc/prometheus_fastapi_instrumentator/middleware.py 95.29% <100.00%> (+0.05%) ⬆️

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

@trallnag
Copy link
Owner Author

There are two changes:

  • Inline instrumentation closure into try catch block to prevent NameError.
  • Checking if instrumentation function is None in middleware.

@trallnag trallnag changed the title chore: Enter regression with upgrade fix: Fix regression multi app Prometheus registry Feb 26, 2023
This reflects that now the metric functions can either instrumentation
function closure or None.

Also add missing registry param to metrics functions.
Relevant because things started to fail with fastapi 0.92.0.
@trallnag trallnag merged commit c858592 into master Mar 8, 2023
@trallnag trallnag deleted the fix-regression-registry branch March 8, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test test_expose_defaults fails due to NameError after updating
1 participant