From 62097612e62a5a6fd9c7fe11907b66fd691639a3 Mon Sep 17 00:00:00 2001 From: Bogdan Berce Date: Fri, 3 Apr 2015 14:26:49 -0700 Subject: [PATCH] Defaulting request collection to the async channel such that the user need not call .flush() --- applicationinsights/requests/WSGIApplication.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/applicationinsights/requests/WSGIApplication.py b/applicationinsights/requests/WSGIApplication.py index 0a2249f..d181012 100644 --- a/applicationinsights/requests/WSGIApplication.py +++ b/applicationinsights/requests/WSGIApplication.py @@ -37,6 +37,10 @@ class WSGIApplication(object): if not wsgi_application: raise Exception('WSGI application was required but not provided') telemetry_channel = kwargs.pop('telemetry_channel', None) + if not telemetry_channel: + sender = applicationinsights.channel.AsynchronousSender() + queue = applicationinsights.channel.AsynchronousQueue(sender) + telemetry_channel = applicationinsights.channel.TelemetryChannel(None, queue) self.client = applicationinsights.TelemetryClient(instrumentation_key, telemetry_channel) self._wsgi_application = wsgi_application