def ready(self): self.client = get_client() register_handlers(self.client) if self.client.config.instrument: instrument(self.client) else: self.client.logger.debug("Skipping instrumentation. INSTRUMENT is set to False.")
def ready(self): self.client = get_client() register_handlers(self.client) if not self.client.config.disable_instrumentation: instrument(self.client) else: self.client.logger.debug( "Skipping instrumentation. DISABLE_INSTRUMENTATION is set.")
def ready(self): client = get_client() register_handlers(client) if 'SKIP_INSTRUMENT' not in os.environ: instrument(client) else: client.logger.debug( "Skipping instrumentation. SKIP_INSTRUMENT is set.")
def ready(self): self.client = get_client() if self.client.config.autoinsert_django_middleware: self.insert_middleware(django_settings) register_handlers(self.client) if self.client.config.instrument: instrument(self.client) else: self.client.logger.debug("Skipping instrumentation. INSTRUMENT is set to False.")
def __init__(self, *args, **kwargs): super(TracingMiddleware, self).__init__(*args, **kwargs) self.client = get_client() if not self._elasticapm_instrumented: with self._instrumenting_lock: if not self._elasticapm_instrumented: if self.client.instrument_django_middleware: self.instrument_middlewares() TracingMiddleware._elasticapm_instrumented = True
def actually_do_stuff(request=None, **kwargs): exc_info = sys.exc_info() client = get_client() try: if (disabled_due_to_debug( getattr(django_settings, 'ELASTIC_APM', {}), django_settings.DEBUG) or getattr(exc_info[1], 'skip_elasticapm', False)): return client.capture('Exception', exc_info=exc_info, request=request) except Exception as exc: try: client.error_logger.exception( u'Unable to process log entry: %s' % (exc, )) except Exception as exc: warnings.warn(u'Unable to process log entry: %s' % (exc, )) finally: try: del exc_info except Exception as e: client.error_logger.exception(e)
def test_proxy_responds_as_client(): assert get_client() == client
def test_get_client(django_elasticapm_client): assert get_client() == get_client() assert get_client('elasticapm.base.Client').__class__ == Client
def client(self): try: app = apps.get_app_config("elasticapm.contrib.django") return app.client except LookupError: return get_client()
def setUp(self): self.elasticapm_client = get_client()