applicationinsights.exceptions module

enable function

applicationinsights.exceptions.enable(instrumentation_key, *args, **kwargs)[source]

Enables the automatic collection of unhandled exceptions. Captured exceptions will be sent to the Application Insights service before being re-thrown. Multiple calls to this function with different instrumentation keys result in multiple instances being submitted, one for each key.

from applicationinsights.exceptions import enable

# set up exception capture
enable('<YOUR INSTRUMENTATION KEY GOES HERE>')

# raise an exception (this will be sent to the Application Insights service as an exception telemetry object)
raise Exception('Boom!')
Args:

instrumentation_key (str). the instrumentation key to use while sending telemetry to the service.