claws / aioprometheus

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

[BUG] Multiple decorator bug #47

Closed grootg closed 3 years ago

grootg commented 4 years ago

While using inprogress and count_exceptions inprogress doesn't reach the metric.dec call Suggested fix (for inprogress):

@wraps(func) async def func_wrapper(*args, **kwds): try: metric.inc(labels) rv = func(*args, **kwds) if isinstance(rv, asyncio.Future) or asyncio.iscoroutine(rv): rv = await rv finally: metric.dec(labels) return rv

claws commented 4 years ago

Thanks for the feedback, I'll look into your suggested fix.

claws commented 3 years ago

Fixed in #55