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

Class _RegularPush

prometheus_client/bridge/graphite.py:23–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class _RegularPush(threading.Thread):
24 def __init__(self, pusher, interval, prefix):
25 super().__init__()
26 self._pusher = pusher
27 self._interval = interval
28 self._prefix = prefix
29
30 def run(self):
31 wait_until = default_timer()
32 while True:
33 while True:
34 now = default_timer()
35 if now >= wait_until:
36 # May need to skip some pushes.
37 while wait_until < now:
38 wait_until += self._interval
39 break
40 # time.sleep can return early.
41 time.sleep(wait_until - now)
42 try:
43 self._pusher.push(prefix=self._prefix)
44 except OSError:
45 logging.exception("Push failed")
46
47
48class GraphiteBridge:

Callers 1

startMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected