Example #1
0
def error_handler(errors):
    # filter out the rather common MSG_ONE_OF errors
    log_errors = []
    for error in errors:
        if error.get('description', '') != MSG_ONE_OF:
            log_errors.append(error)
    if log_errors:
        get_client('ichnaea').debug('error_handler' + repr(log_errors))
    return _JSONError(errors, errors.status)
Example #2
0
    def setUpClass(cls):
        super(DBTestCase, cls).setup_engine()

        # Clobber the stream with a debug version
        from heka.holder import get_client
        heka_client = get_client('ichnaea')
        use_hekatest(heka_client)
Example #3
0
 def test_get_client_with_cfg(self):
     cfg = {'logger': 'amo.dev',
            'stream': {'class': 'heka.streams.UdpStream',
                       'host': ['logstash1', 'logstash2'],
                       'port': '5566'},
            }
     heka = get_client('amo.dev', cfg)
     assert heka != None
Example #4
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db(create=False)
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=get_client('ichnaea'))
     app.get('/stats_location.json', status=200)
Example #5
0
 def test_get_client_with_cfg(self):
     cfg = {
         'logger': 'amo.dev',
         'stream': {
             'class': 'heka.streams.UdpStream',
             'host': ['logstash1', 'logstash2'],
             'port': '5566'
         },
     }
     heka = get_client('amo.dev', cfg)
     assert heka != None
Example #6
0
    def setUpClass(cls):
        super(AppTestCase, cls).setup_engine()

        # Clobber the stream with a debug version
        from heka.holder import get_client
        heka_client = get_client('ichnaea')

        use_hekatest(heka_client)

        cls.app = _make_app(_db_master=cls.db_master,
                            _db_slave=cls.db_slave,
                            _heka_client=heka_client)
Example #7
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_master_socket': SQLSOCKET,
         'db_slave': SQLURI,
         'db_slave_socket': SQLSOCKET,
         '_heka_client': get_client('ichnaea'),
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_location.json', status=200)
Example #8
0
def configure_heka(registry_settings={}):
    # If a test client is defined just use that instead of whatever is
    # defined in the configuration
    if '_heka_client' in registry_settings:
        return registry_settings['_heka_client']

    # deal with konfig's include/extends syntax and construct a merged
    # file-like object from all the files
    merged_stream = StringIO()
    konfig = config()
    konfig.write(merged_stream)
    merged_stream.seek(0)

    client = get_client('ichnaea')
    client = client_from_text_config(merged_stream.read(), 'heka', client)

    return client
Example #9
0
 def setUp(self):
     CeleryTestCase.setUp(self)
     self.heka_client = get_client('ichnaea')
     self.heka_client.stream.msgs.clear()
Example #10
0
 def test_get_client(self):
     heka = get_client('new_client')
     assert heka != None
Example #11
0
def get_heka_client():
    return get_client('ichnaea')
Example #12
0
 def test_get_client(self):
     heka = get_client('new_client')
     assert heka != None
Example #13
0
def get_heka_client():
    return get_client('ichnaea')
Example #14
0
 def __call__(self, *args, **kw):
     with get_client('ichnaea').timer("task." + self.shortname):
         result = super(DatabaseTask, self).__call__(*args, **kw)
     return result
Example #15
0
def get_heka_client():
    return get_client("ichnaea")