MCPcopy Index your code
hub / github.com/prometheus/client_python / time

Method time

prometheus_client/metrics.py:480–485  ·  view source on GitHub ↗

Time a block of code or function, and set the duration in seconds. Can be used as a function decorator or context manager.

(self)

Source from the content-addressed store, hash-verified

478 return InprogressTracker(self)
479
480 def time(self) -> Timer:
481 """Time a block of code or function, and set the duration in seconds.
482
483 Can be used as a function decorator or context manager.
484 """
485 return Timer(self, 'set')
486
487 def set_function(self, f: Callable[[], float]) -> None:
488 """Call the provided function to return the Gauge value.

Callers 15

_metric_initMethod · 0.45
incMethod · 0.45
resetMethod · 0.45
setMethod · 0.45
set_to_current_timeMethod · 0.45
_metric_initMethod · 0.45
_metric_initMethod · 0.45
observeMethod · 0.45
managerMethod · 0.45
fMethod · 0.45

Calls 1

TimerClass · 0.85

Tested by 9

managerMethod · 0.36
fMethod · 0.36
test_block_decoratorMethod · 0.36
managerMethod · 0.36
test_block_decoratorMethod · 0.36