{"id":5574,"library":"azure-applicationinsights","title":"Azure Application Insights Client (Legacy)","description":"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.","status":"abandoned","version":"0.1.1","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","telemetry","monitoring","application insights","observability","legacy"],"install":[{"cmd":"pip install azure-applicationinsights","lang":"bash","label":"For legacy client (version <= 0.1.1)"}],"dependencies":[],"imports":[{"note":"The PyPI package `azure-applicationinsights` installs the `applicationinsights` module. Newer Azure SDKs use a different import structure and entirely different packages for Application Insights integration.","wrong":"from azure_applicationinsights import TelemetryClient","symbol":"TelemetryClient","correct":"from applicationinsights import TelemetryClient"}],"quickstart":{"code":"import os\nfrom applicationinsights import TelemetryClient\n\n# Get your Application Insights Instrumentation Key from environment variable\n# For Azure Portal: Application Insights -> Overview -> Essentials -> Instrumentation Key\ninstrumentation_key = os.environ.get('APPINSIGHTS_INSTRUMENTATION_KEY', 'YOUR_INSTRUMENTATION_KEY')\n\nif not instrumentation_key or instrumentation_key == 'YOUR_INSTRUMENTATION_KEY':\n    print(\"WARNING: APPINSIGHTS_INSTRUMENTATION_KEY environment variable not set or placeholder used.\")\n    print(\"Please set it to run this example.\")\nelse:\n    client = TelemetryClient(instrumentation_key)\n\n    # Track a simple event\n    client.track_event('TestEvent', properties={'key': 'value'})\n\n    # Track a metric\n    client.track_metric('TestMetric', 42.0)\n\n    # Track a trace message\n    client.track_trace('This is a test trace message.', properties={'level': 'INFO'})\n\n    # Flush the telemetry buffer (important for short-lived scripts)\n    client.flush()\n    print(\"Telemetry sent using legacy client.\")","lang":"python","description":"Demonstrates how to initialize the legacy `TelemetryClient` and send basic event, metric, and trace telemetry. Note that this library is deprecated."},"warnings":[{"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`.","message":"The `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.","severity":"breaking","affected_versions":"All versions of `azure-applicationinsights` (0.1.1 and older)"},{"fix":"Always use `from applicationinsights import ...` for this specific legacy package.","message":"The 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.","severity":"gotcha","affected_versions":"All versions of `azure-applicationinsights` (0.1.1 and older)"},{"fix":"Plan for migration to `opencensus-ext-azure` or `azure-monitor-opentelemetry-exporter` to ensure compatibility and access to future features.","message":"This 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.","severity":"deprecated","affected_versions":"All versions of `azure-applicationinsights` (0.1.1 and older)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}