def configure_from_settings(app, conf, **kwargs): from django.conf import settings brokers = [ f"kafka://{broker}" for broker in settings.KAFKA_BROKERS_URL.split(",") ] conf.broker = brokers conf.logging_config = settings.LOGGING if settings.KAFKA_USE_SSL: ssl_context = ssl.create_default_context( purpose=ssl.Purpose.SERVER_AUTH) conf.broker_credentials = ssl_context if settings.DATADOG_HOST: conf.monitor = DatadogMonitor(settings.DATADOG_HOST)
def mon(self, *, statsd, dogstatsd): mon = DatadogMonitor() return mon
def test_raises_if_datadog_not_installed(self, *, monkeypatch): monkeypatch.setattr('faust.sensors.datadog.datadog', None) with pytest.raises(ImproperlyConfigured): DatadogMonitor()
def mon(self, *, statsd, dogstatsd, time): mon = DatadogMonitor(time=time) return mon