def testEqual(self): m1 = Metric(name="test", value=10, ts=0) m2 = Metric(name="test", value=10, ts=0) self.assertEqual(m1, m2) self.assertFalse(m1 < m2) self.assertFalse(m1 > m2) self.assertTrue(m1 == m2)
def add(self, value): self._values.add(Metric(name=self.name, value=value))
def __init__(self, cleanup=None): super(HeartBeat, self).__init__(cleanup) self.value = 0 self.add(Metric(name='heartbeat', value=self.value))
def on_send(self): self.value += 1 self._values = set([]) self.add(Metric(name='heartbeat', value=self.value))