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

👷 chore(dev): Support middleware for Prometheus metrics #262

Merged
merged 3 commits into from
Oct 2, 2022

Conversation

yezz123
Copy link
Owner

@yezz123 yezz123 commented Oct 1, 2022

FastAPI middleware for collecting and exposing Prometheus metrics.

Usage

from fastapi import FastAPI
from authx.middleware import MetricsMiddleware, get_metrics

app = FastAPI()
app.add_middleware(MetricsMiddleware)
app.add_route("/metrics", get_metrics)

@yezz123 yezz123 added the enhancement New feature or request label Oct 1, 2022
@yezz123 yezz123 self-assigned this Oct 1, 2022
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 1, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 4.80%.

Quality metrics Before After Change
Complexity 0.00 ⭐ 0.00 ⭐ 0.00
Method Length 24.00 ⭐ 37.00 ⭐ 13.00 👎
Working memory 3.00 ⭐ 4.00 ⭐ 1.00 👎
Quality 97.67% 92.87% -4.80% 👎
Other metrics Before After Change
Lines 4 5 1
Changed files Quality Before Quality After Quality Change
authx/middleware/init.py 97.67% ⭐ 92.87% ⭐ -4.80% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@codecov
Copy link

codecov bot commented Oct 1, 2022

Codecov Report

Base: 91.47% // Head: 91.79% // Increases project coverage by +0.31% 🎉

Coverage data is based on head (01e0096) compared to base (bfcbd9a).
Patch coverage: 98.85% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #262      +/-   ##
==========================================
+ Coverage   91.47%   91.79%   +0.31%     
==========================================
  Files          56       58       +2     
  Lines        1936     2022      +86     
==========================================
+ Hits         1771     1856      +85     
- Misses        165      166       +1     
Impacted Files Coverage Δ
tests/middleware/test_metrics.py 97.05% <97.05%> (ø)
authx/middleware/__init__.py 100.00% <100.00%> (ø)
authx/middleware/metrics.py 100.00% <100.00%> (ø)

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

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@yezz123 yezz123 merged commit 87cea51 into main Oct 2, 2022
@yezz123 yezz123 deleted the feat/metrics branch October 2, 2022 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant