Ejemplo n.º 1
0
 def test_send_metric(self, mock):
     socket = Mock()
     mock.return_value = socket
     galena = Galena()
     galena.send("tiger.flu", 1, 1311003170)
     self.assertTrue(mock.called)
     self.assertEquals(socket.method_calls[0],
                       ('connect', (('localhost', 2003), ), {}))
     self.assertEquals(socket.method_calls[1],
                       ('send', ('tiger.flu 1 1311003170', ), {}))
Ejemplo n.º 2
0
    def __init__(self, crawler):
        super(GraphiteStatsCollector, self).__init__(crawler)

        host = crawler.settings.get("GRAPHITE_HOST", GRAPHITE_HOST)
        port = crawler.settings.get("GRAPHITE_PORT", GRAPHITE_PORT)

        self.ignore_keys = crawler.settings.get("GRAPHITE_IGNOREKEYS",
                                                GRAPHITE_IGNOREKEYS)
        self.crawler = crawler
        self._galena = Galena(host=host, port=port)