Skip to content

Commit

Permalink
add Timer decorator support partial function
Browse files Browse the repository at this point in the history
Signed-off-by: dafu-wu <[email protected]>
  • Loading branch information
吴成义 committed Nov 21, 2022
1 parent db391db commit 2496d0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion prometheus_client/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from __future__ import print_function

import collections
import functools
import inspect
import itertools
import operator
Expand Down Expand Up @@ -105,7 +106,7 @@ def __init__(self, func=None, name=None, signature=None,
self.name = '_lambda_'
self.doc = func.__doc__
self.module = func.__module__
if inspect.isfunction(func):
if inspect.isfunction(func) or isinstance(func, functools.partial):
argspec = getfullargspec(func)
self.annotations = getattr(func, '__annotations__', {})
for a in ('args', 'varargs', 'varkw', 'defaults', 'kwonlyargs',
Expand Down

0 comments on commit 2496d0e

Please sign in to comment.