{"library":"azure-monitor-opentelemetry","code":"import os\nfrom azure.monitor.opentelemetry import configure_azure_monitor\nfrom opentelemetry import trace\n\n# Set your Application Insights Connection String as an environment variable:\n# APPLICATIONINSIGHTS_CONNECTION_STRING=\"InstrumentationKey=YOUR_INSTRUMENTATION_KEY;IngestionEndpoint=https://YOUR_REGION.in.applicationinsights.azure.com/\"\n\n# One-line setup - reads connection string from the environment variable\n# APPLICATIONINSIGHTS_CONNECTION_STRING. Call this early in your application.\nconfigure_azure_monitor()\n\n# Get a tracer from OpenTelemetry\ntracer = trace.get_tracer(__name__)\n\n# Create a sample span\nwith tracer.start_as_current_span(\"my-example-span\"):\n    print(\"Hello from an OpenTelemetry-instrumented application!\")\n    # Simulate some work\n    import time\n    time.sleep(0.1)\n\nprint(\"Telemetry sent to Azure Monitor (if connection string is configured).\")","lang":"python","description":"This quickstart demonstrates how to initialize the Azure Monitor OpenTelemetry Distro. Ensure the `APPLICATIONINSIGHTS_CONNECTION_STRING` environment variable is set with your Azure Application Insights connection string. The `configure_azure_monitor()` function automatically sets up the necessary OpenTelemetry components. A simple custom span is created to illustrate basic tracing.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}