Ejemplo n.º 1
0
 def __init__(self, meterId, clock=SystemClock()):
     self.meterId = meterId
     self._clock = clock
     self._count = AtomicNumber(0)
     self._totalTime = AtomicNumber(0)
     self._totalOfSquares = AtomicNumber(0)
     self._max = AtomicNumber(0)
Ejemplo n.º 2
0
    def __init__(
        self,
        meter_id: MeterId,
        clock: Clock = SystemClock(),
        meter_type: str = "t",
        writer: SidecarWriter = SidecarWriter.create("none")
    ) -> None:
        if meter_type not in ["t", "T"]:
            raise ValueError("Timers must have a meter type of 't' or 'T'.")

        super().__init__(meter_id, meter_type)
        self._clock = clock
        self._writer = writer
Ejemplo n.º 3
0
 def __init__(self, clock=SystemClock()):
     self._clock = clock
     self._lock = threading.RLock()
     self._meters = {}
     self._started = False
Ejemplo n.º 4
0
 def __init__(self, meterId, clock=SystemClock()):
     self.meterId = meterId
     self._clock = clock
     self._last_update = AtomicNumber(float('nan'))
     self._value = AtomicNumber(float('nan'))
Ejemplo n.º 5
0
 def __init__(self, clock: Clock = SystemClock(),
              config: SidecarConfig = SidecarConfig()) -> None:
     self._clock = clock
     self._common_tags = config.common_tags()
     self._writer = SidecarWriter.create(config.output_location())
Ejemplo n.º 6
0
 def test_monotonic_time(self):
     c = SystemClock()
     start = c.monotonic_time()
     time.sleep(0.01)
     end = c.monotonic_time()
     self.assertTrue(end > start, "{} > {}".format(end, start))