{
  "schema": "https://ai-atoms.com/schemas/skill-v1.json",
  "type": "skill",
  "id": "skill/azure-monitor-opentelemetry-py",
  "version": "1.0.1",
  "name": "Azure Monitor Opentelemetry Py",
  "description": "Azure Monitor OpenTelemetry Distro for Python. Use for one-line Application Insights setup with auto-instrumentation.\nTriggers: \"azure-monitor-opentelemetry\", \"configure_azure_monitor\", \"Application Insights\", \"OpenTelemetry distro\", \"auto-instrumentation\".",
  "system_prompt_fragment": "# Azure Monitor OpenTelemetry Distro for Python\n\nOne-line setup for Application Insights with OpenTelemetry auto-instrumentation.\n\n## Installation\n\n```bash\npip install azure-monitor-opentelemetry\n```\n\n## Environment Variables\n\n```bash\nAPPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/\n```\n\n## Quick Start\n\n```python\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\n# One-line setup - reads connection string from environment\nconfigure_azure_monitor()\n\n# Your application code...\n```\n\n## Explicit Configuration\n\n```python\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor(\n    connection_string=\"InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/\"\n)\n```\n\n## With Flask\n\n```python\nfrom flask import Flask\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor()\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef hello():\n    return \"Hello, World!\"\n\nif __name__ == \"__main__\":\n    app.run()\n```\n\n## With Django\n\n```python\n# settings.py\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor()\n\n# Django settings...\n```\n\n## With FastAPI\n\n```python\nfrom fastapi import FastAPI\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor()\n\napp = FastAPI()\n\n@app.get(\"/\")\nasync def root():\n    return {\"message\": \"Hello World\"}\n```\n\n## Custom Traces\n\n```python\nfrom opentelemetry import trace\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor()\n\ntracer = trace.get_tracer(__name__)\n\nwith tracer.start_as_current_span(\"my-operation\") as span:\n    span.set_attribute(\"custom.attribute\", \"value\")\n    # Do work...\n```\n\n## Custom Metrics\n\n```python\nfrom opentelemetry import metrics\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor()\n\nmeter = metrics.get_meter(__name__)\ncounter = meter.create_counter(\"my_counter\")\n\ncounter.add(1, {\"dimension\": \"value\"})\n```\n\n## Custom Logs\n\n```python\nimport logging\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor()\n\nlogger = logging.getLogger(__name__)\nlogger.setLevel(logging.INFO)\n\nlogger.info(\"This will appear in Application Insights\")\nlogger.error(\"Errors are captured too\", exc_info=True)\n```\n\n## Sampling\n\n```python\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\n# Sample 10% of requests\nconfigure_azure_monitor(\n    sampling_ratio=0.1\n)\n```\n\n## Cloud Role Name\n\nSet cloud role name for Application Map:\n\n```python\nfrom azure.monitor.opentelemetry import configure_azure_monitor\nfrom opentelemetry.sdk.resources import Resource, SERVICE_NAME\n\nconfigure_azure_monitor(\n    resource=Resource.create({SERVICE_NAME: \"my-service-name\"})\n)\n```\n\n## Disable Specific Instrumentations\n\n```python\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor(\n    instrumentations=[\"flask\", \"requests\"]  # Only enable these\n)\n```\n\n## Enable Live Metrics\n\n```python\nfrom azure.monitor.opentelemetry import configure_azure_monitor\n\nconfigure_azure_monitor(\n    enable_live_metrics=True\n)\n```\n\n## Azure AD Authentication\n\n```python\nfrom azure.monitor.opentelemetry import configure_azure_monitor\nfrom azure.identity import DefaultAzureCredential\n\nconfigure_azure_monitor(\n    credential=DefaultAzureCredential()\n)\n```\n\n## Auto-Instrumentations Included\n\n| Library | Telemetry Type |\n|---------|---------------|\n| Flask | Traces |\n| Django | Traces |\n| FastAPI | Traces |\n| Requests | Traces |\n| urllib3 | Traces |\n| httpx | Traces |\n| aiohttp | Traces |\n| psycopg2 | Traces |\n| pymysql | Traces |\n| pymongo | Traces |\n| redis | Traces |\n\n## Configuration Options\n\n| Parameter | Description | Default |\n|-----------|-------------|---------|\n| `connection_string` | Application Insights connection string | From env var |\n| `credential` | Azure credential for AAD auth | None |\n| `sampling_ratio` | Sampling rate (0.0 to 1.0) | 1.0 |\n| `resource` | OpenTelemetry Resource | Auto-detected |\n| `instrumentations` | List of instrumentations to enable | All |\n| `enable_live_metrics` | Enable Live Metrics stream | False |\n\n## Best Practices\n\n1. **Call configure_azure_monitor() early** — Before importing instrumented libraries\n2. **Use environment variables** for connection string in production\n3. **Set cloud role name** for multi-service applications\n4. **Enable sampling** in high-traffic applications\n5. **Use structured logging** for better log analytics queries\n6. **Add custom attributes** to spans for better debugging\n7. **Use AAD authentication** for production workloads\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.",
  "applicable_domains": [
    "devops"
  ],
  "category": "devops",
  "invocation": [
    "/azure-monitor-opentelemetry-py"
  ],
  "authored_by": "claudeskills.in community",
  "source_url": "https://claudeskills.in/skill/azure-monitor-opentelemetry-py",
  "provenance": {
    "source": "claudeskills.in",
    "source_url": "https://claudeskills.in/skill/azure-monitor-opentelemetry-py",
    "license": "unknown",
    "imported_at": "2026-09-03",
    "notes": "Aggregated by claudeskills.in from community GitHub lists."
  },
  "tags": [
    "claudeskills",
    "devops"
  ],
  "lifecycle": "draft"
}