Registry /
azure / azure-applicationinsights
Install & Compatibility
Where this runs
tested against v0.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 26.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.7s · import 0.000s · 27MB
25MB installed
● package 25MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TelemetryClient
✓ from azure.applicationinsights import TelemetryClient
✗ from azure.applicationinsights import TelemetryClient
Demonstrates how to initialize the legacy `TelemetryClient` and send basic event, metric, and trace telemetry. Note that this library is deprecated.
import os
from applicationinsights import TelemetryClient
# Get your Application Insights Instrumentation Key from environment variable
# For Azure Portal: Application Insights -> Overview -> Essentials -> Instrumentation Key
instrumentation_key = os.environ.get('APPINSIGHTS_INSTRUMENTATION_KEY', 'YOUR_INSTRUMENTATION_KEY')
if not instrumentation_key or instrumentation_key == 'YOUR_INSTRUMENTATION_KEY':
print("WARNING: APPINSIGHTS_INSTRUMENTATION_KEY environment variable not set or placeholder used.")
print("Please set it to run this example.")
else:
client = TelemetryClient(instrumentation_key)
# Track a simple event
client.track_event('TestEvent', properties={'key': 'value'})
# Track a metric
client.track_metric('TestMetric', 42.0)
# Track a trace message
client.track_trace('This is a test trace message.', properties={'level': 'INFO'})
# Flush the telemetry buffer (important for short-lived scripts)
client.flush()
print("Telemetry sent using legacy client.")
Debug
Known issues
breakingThe `azure-applicationinsights` library (version <= 0.1.1) is deprecated and no longer actively maintained. Modern Python applications should use `opencensus-ext-azure` or `azure-monitor-opentelemetry-exporter` for Application Insights integration. These new approaches require significant code changes.fixMigrate to `pip install opencensus-ext-azure` or `pip install azure-monitor-opentelemetry-exporter` and rewrite telemetry collection code according to their respective documentation. For `opencensus-ext-azure`, see `from opencensus.ext.azure.trace_exporter import AzureExporter`. For OpenTelemetry, see `from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter`.
affects: All versions of `azure-applicationinsights` (0.1.1 and older)
gotchaThe PyPI package is `azure-applicationinsights`, but the top-level import module is `applicationinsights`. This can lead to `ModuleNotFoundError` if `from azure_applicationinsights import ...` or `from azure.applicationinsights import ...` is attempted.fixAlways use `from applicationinsights import ...` for this specific legacy package.
affects: All versions of `azure-applicationinsights` (0.1.1 and older)
deprecatedThis library relies on an older approach for telemetry collection and might not support newer Application Insights features or conform to modern Azure SDK guidelines. Consider it end-of-life for new development.fixPlan for migration to `opencensus-ext-azure` or `azure-monitor-opentelemetry-exporter` to ensure compatibility and access to future features.
affects: All versions of `azure-applicationinsights` (0.1.1 and older)
Upgrade
Version history
0.1.1latest on PyPI · released Feb 11, 2022
Audit
Dependencies
No dependency data recorded yet.