class GitoramaStats(Plugin): name = 'gitorama' host = 'localhost' port = 6379 def __init__(self): super(GitoramaStats, self).__init__() self._db = None self.stats = Stats(self.get_redis) def get_redis(self): if self._db is None: self._db = redis.StrictRedis( host=self.host, port=self.port, ) return self._db def on_read(self): values = self.stats.get_all_values() for key, value in values.items(): self.dispatch_value(key, value, 'gauge')
def __init__(self): super(GitoramaStats, self).__init__() self._db = None self.stats = Stats(self.get_redis)