Registry / azure / azure-applicationinsights

azure-applicationinsights

JSON →
library0.1.1pypypi✓ verified 22d ago

This is the legacy Python client library for sending telemetry to Microsoft Azure Application Insights. It was last updated in October 2018 (version 0.1.1) and has since been superseded by `opencensus-ext-azure` and more recently by `azure-monitor-opentelemetry-exporter` for modern Azure Monitor integration. This package is no longer actively maintained.

pip install azure-applicationinsights
INSTALL
IMPORT
SIG · AZURE-APPLICATIONI
A
azure-applicationinsights
azurepythonv0.1.1
Install
2.7s avg
Import
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 26.5MB
glibc
py 3.103.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.
fix
Migrate 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.
fix
Always 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.
fix
Plan 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.

Agent activity
44 hits · last 30 days
node
38
OpenAI (training)
1
Resources
azure-applicationinsights — pip install azure-applicationinsights · libregistry