applicationinsights.client module

enable function

applicationinsights.client.enable_for_requests(instrumentation_key, telemetry_channel=None, always_flush=False)[source]

Enables the automatic collection of dependency telemetries for HTTP calls with requests.

from applicationinsights.client import enable_for_requests
import requests

enable_for_requests('<YOUR INSTRUMENTATION KEY GOES HERE>')

requests.get("https://www.python.org/")
# a dependency telemetry will be sent to the Application Insights service
Args:

instrumentation_key (str). the instrumentation key to use while sending telemetry to the service. telemetry_channel (TelemetryChannel). a custom telemetry channel to use always_flush (bool). if true every HTTP call will flush the dependency telemetry

applicationinsights.client.enable_for_urllib3(instrumentation_key, telemetry_channel=None, always_flush=False)[source]

Enables the automatic collection of dependency telemetries for HTTP calls with urllib3.

from applicationinsights.client import enable_for_urllib3
import urllib3.requests

enable_for_urllib3('<YOUR INSTRUMENTATION KEY GOES HERE>')

urllib3.PoolManager().request("GET", "https://www.python.org/")
# a dependency telemetry will be sent to the Application Insights service
Args:

instrumentation_key (str). the instrumentation key to use while sending telemetry to the service. telemetry_channel (TelemetryChannel). a custom telemetry channel to use always_flush (bool). if true every HTTP call will flush the dependency telemetry

applicationinsights.client.enable_for_urllib2(instrumentation_key, telemetry_channel=None, always_flush=False)[source]

Enables the automatic collection of dependency telemetries for HTTP calls with urllib2.

from applicationinsights.client import enable_for_urllib2
import urllib2

enable_for_urllib2('<YOUR INSTRUMENTATION KEY GOES HERE>')

urllib2.urlopen("https://www.python.org/")
# a dependency telemetry will be sent to the Application Insights service
Args:

instrumentation_key (str). the instrumentation key to use while sending telemetry to the service. telemetry_channel (TelemetryChannel). a custom telemetry channel to use always_flush (bool). if true every HTTP call will flush the dependency telemetry

applicationinsights.client.enable_for_urllib(instrumentation_key, telemetry_channel=None, always_flush=False)[source]

Enables the automatic collection of dependency telemetries for HTTP calls with urllib.

from applicationinsights.client import enable_for_urllib
import urllib.requests

enable_for_urllib('<YOUR INSTRUMENTATION KEY GOES HERE>')

urllib.request.urlopen("https://www.python.org/")
# a dependency telemetry will be sent to the Application Insights service
Args:

instrumentation_key (str). the instrumentation key to use while sending telemetry to the service. telemetry_channel (TelemetryChannel). a custom telemetry channel to use always_flush (bool). if true every HTTP call will flush the dependency telemetry