claws / aioprometheus

A Prometheus Python client library for asyncio-based applications
174 stars 21 forks source link

Middleware const_labels argument #73

Closed ngerakines closed 2 years ago

ngerakines commented 2 years ago

This minor addition to the Middleware class allows const_labels to be provided and passed to the counters created at construction.

Usage:

app = FastAPI()
app.add_middleware(MetricsMiddleware, const_labels={"app": "webapi"})
claws commented 2 years ago

Looks like it's just a style issue holding up the CI pipeline. Can you run make style, see: style, then push the changes to this branch?

codecov-commenter commented 2 years ago

Codecov Report

Merging #73 (d11f2c6) into master (b07f21c) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #73   +/-   ##
=======================================
  Coverage   95.50%   95.50%           
=======================================
  Files          17       17           
  Lines         778      779    +1     
  Branches      114      114           
=======================================
+ Hits          743      744    +1     
  Misses         19       19           
  Partials       16       16           
Impacted Files Coverage Δ
src/aioprometheus/asgi/middleware.py 87.50% <100.00%> (+0.19%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b07f21c...d11f2c6. Read the comment docs.

claws commented 2 years ago

Thanks