{"id":"871dce19-4bcc-418a-915c-032598899ce7","shortId":"5NNsvt","kind":"skill","title":"azure-monitor-opentelemetry-exporter-py","tagline":"Azure Monitor OpenTelemetry Exporter for Python. Use for low-level OpenTelemetry export to Application Insights.","description":"# Azure Monitor OpenTelemetry Exporter for Python\n\nLow-level exporter for sending OpenTelemetry traces, metrics, and logs to Application Insights.\n\n## Installation\n\n```bash\npip install azure-monitor-opentelemetry-exporter\n```\n\n## Environment Variables\n\n```bash\nAPPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/\n```\n\n## When to Use\n| Scenario | Use |\n|----------|-----|\n| Quick setup, auto-instrumentation | `azure-monitor-opentelemetry` (distro) |\n| Custom OpenTelemetry pipeline | `azure-monitor-opentelemetry-exporter` (this) |\n| Fine-grained control over telemetry | `azure-monitor-opentelemetry-exporter` (this) |\n\n## Trace Exporter\n\n```python\nfrom opentelemetry import trace\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import BatchSpanProcessor\nfrom azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter\n\n# Create exporter\nexporter = AzureMonitorTraceExporter(\n    connection_string=\"InstrumentationKey=xxx;...\"\n)\n\n# Configure tracer provider\ntrace.set_tracer_provider(TracerProvider())\ntrace.get_tracer_provider().add_span_processor(\n    BatchSpanProcessor(exporter)\n)\n\n# Use tracer\ntracer = trace.get_tracer(__name__)\nwith tracer.start_as_current_span(\"my-span\"):\n    print(\"Hello, World!\")\n```\n\n## Metric Exporter\n\n```python\nfrom opentelemetry import metrics\nfrom opentelemetry.sdk.metrics import MeterProvider\nfrom opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader\nfrom azure.monitor.opentelemetry.exporter import AzureMonitorMetricExporter\n\n# Create exporter\nexporter = AzureMonitorMetricExporter(\n    connection_string=\"InstrumentationKey=xxx;...\"\n)\n\n# Configure meter provider\nreader = PeriodicExportingMetricReader(exporter, export_interval_millis=60000)\nmetrics.set_meter_provider(MeterProvider(metric_readers=[reader]))\n\n# Use meter\nmeter = metrics.get_meter(__name__)\ncounter = meter.create_counter(\"requests_total\")\ncounter.add(1, {\"route\": \"/api/users\"})\n```\n\n## Log Exporter\n\n```python\nimport logging\nfrom opentelemetry._logs import set_logger_provider\nfrom opentelemetry.sdk._logs import LoggerProvider, LoggingHandler\nfrom opentelemetry.sdk._logs.export import BatchLogRecordProcessor\nfrom azure.monitor.opentelemetry.exporter import AzureMonitorLogExporter\n\n# Create exporter\nexporter = AzureMonitorLogExporter(\n    connection_string=\"InstrumentationKey=xxx;...\"\n)\n\n# Configure logger provider\nlogger_provider = LoggerProvider()\nlogger_provider.add_log_record_processor(BatchLogRecordProcessor(exporter))\nset_logger_provider(logger_provider)\n\n# Add handler to Python logging\nhandler = LoggingHandler(level=logging.INFO, logger_provider=logger_provider)\nlogging.getLogger().addHandler(handler)\n\n# Use logging\nlogger = logging.getLogger(__name__)\nlogger.info(\"This will be sent to Application Insights\")\n```\n\n## From Environment Variable\n\nExporters read `APPLICATIONINSIGHTS_CONNECTION_STRING` automatically:\n\n```python\nfrom azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter\n\n# Connection string from environment\nexporter = AzureMonitorTraceExporter()\n```\n\n## Azure AD Authentication\n\n```python\nfrom azure.identity import DefaultAzureCredential\nfrom azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter\n\nexporter = AzureMonitorTraceExporter(\n    credential=DefaultAzureCredential()\n)\n```\n\n## Sampling\n\nUse `ApplicationInsightsSampler` for consistent sampling:\n\n```python\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.sampling import ParentBasedTraceIdRatio\nfrom azure.monitor.opentelemetry.exporter import ApplicationInsightsSampler\n\n# Sample 10% of traces\nsampler = ApplicationInsightsSampler(sampling_ratio=0.1)\n\ntrace.set_tracer_provider(TracerProvider(sampler=sampler))\n```\n\n## Offline Storage\n\nConfigure offline storage for retry:\n\n```python\nfrom azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter\n\nexporter = AzureMonitorTraceExporter(\n    connection_string=\"...\",\n    storage_directory=\"/path/to/storage\",  # Custom storage path\n    disable_offline_storage=False  # Enable retry (default)\n)\n```\n\n## Disable Offline Storage\n\n```python\nexporter = AzureMonitorTraceExporter(\n    connection_string=\"...\",\n    disable_offline_storage=True  # No retry on failure\n)\n```\n\n## Sovereign Clouds\n\n```python\nfrom azure.identity import AzureAuthorityHosts, DefaultAzureCredential\nfrom azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter\n\n# Azure Government\ncredential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)\nexporter = AzureMonitorTraceExporter(\n    connection_string=\"InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.us/\",\n    credential=credential\n)\n```\n\n## Exporter Types\n\n| Exporter | Telemetry Type | Application Insights Table |\n|----------|---------------|---------------------------|\n| `AzureMonitorTraceExporter` | Traces/Spans | requests, dependencies, exceptions |\n| `AzureMonitorMetricExporter` | Metrics | customMetrics, performanceCounters |\n| `AzureMonitorLogExporter` | Logs | traces, customEvents |\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| `disable_offline_storage` | Disable retry storage | False |\n| `storage_directory` | Custom storage path | Temp directory |\n\n## Best Practices\n\n1. **Use BatchSpanProcessor** for production (not SimpleSpanProcessor)\n2. **Use ApplicationInsightsSampler** for consistent sampling across services\n3. **Enable offline storage** for reliability in production\n4. **Use AAD authentication** instead of instrumentation keys\n5. **Set export intervals** appropriate for your workload\n6. **Use the distro** (`azure-monitor-opentelemetry`) unless you need custom pipelines\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["azure","monitor","opentelemetry","exporter","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents"],"capabilities":["skill","source-sickn33","skill-azure-monitor-opentelemetry-exporter-py","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-monitor-opentelemetry-exporter-py","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34928 github stars · SKILL.md body (6,275 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T18:50:32.667Z","embedding":null,"createdAt":"2026-04-18T21:32:52.680Z","updatedAt":"2026-04-24T18:50:32.667Z","lastSeenAt":"2026-04-24T18:50:32.667Z","tsv":"'/api/users':215 '/path/to/storage':384 '0.1':359 '1':213,498 '10':352 '2':505 '3':513 '4':521 '5':529 '6':537 '60000':193 'aad':479,523 'across':511 'ad':317 'add':135,267 'addhandl':281 'applic':21,41,294,445,468 'applicationinsight':55,301 'applicationinsightssampl':334,350,356,507 'appropri':533 'ask':583 'auth':480 'authent':318,524 'author':427 'auto':70 'auto-instrument':69 'automat':304 'azur':2,7,23,48,73,81,93,316,423,476,542 'azure-monitor-opentelemetri':72,541 'azure-monitor-opentelemetry-export':47,80,92 'azure-monitor-opentelemetry-exporter-pi':1 'azure.identity':321,415 'azure.monitor.opentelemetry.exporter':114,173,239,307,325,348,375,420 'azureauthorityhost':417 'azureauthorityhosts.azure':428 'azuremonitorlogexport':241,245,457 'azuremonitormetricexport':175,179,453 'azuremonitortraceexport':116,120,309,315,327,329,377,379,400,422,431,448 'bash':44,54 'batchlogrecordprocessor':237,260 'batchspanprocessor':112,138,500 'best':496 'boundari':591 'clarif':585 'clear':558 'cloud':412 'configur':125,184,250,368,461 'connect':56,121,180,246,302,310,380,401,432,466,470 'consist':336,509 'control':89 'counter':207,209 'counter.add':212 'creat':117,176,242 'credenti':330,425,438,439,475,477 'criteria':594 'current':149 'custom':77,385,491,548 'customev':460 'custommetr':455 'default':394,465 'defaultazurecredenti':323,331,418,426 'depend':451 'describ':562 'descript':464 'directori':383,490,495 'disabl':388,395,403,482,485 'distro':76,540 'enabl':392,514 'env':473 'environ':52,297,313,574 'environment-specif':573 'except':452 'expert':579 'export':5,10,19,26,32,51,84,96,99,118,119,139,158,177,178,189,190,217,243,244,261,299,314,328,378,399,430,440,442,531 'failur':410 'fals':391,488 'fine':87 'fine-grain':86 'govern':424,429 'grain':88 'handler':268,272,282 'hello':155 'import':103,107,111,115,162,166,170,174,219,223,230,236,240,308,322,326,341,345,349,376,416,421 'ingestionendpoint':60,436 'input':588 'insight':22,42,295,446,469 'instal':43,46 'instead':525 'instrument':71,527 'instrumentationkey':58,123,182,248,434 'interv':191,532 'key':528 'level':17,31,274 'limit':550 'log':39,216,220,229,257,271,284,458 'logger':225,251,253,263,265,276,278,285 'logger.info':288 'logger_provider.add':256 'loggerprovid':231,255 'logging.getlogger':280,286 'logging.info':275 'logginghandl':232,273 'logs.export':235 'low':16,30 'low-level':15,29 'match':559 'meter':185,195,202,203,205 'meter.create':208 'meterprovid':167,197 'metric':37,157,163,198,454 'metrics.get':204 'metrics.set':194 'milli':192 'miss':596 'monitor':3,8,24,49,74,82,94,543 'my-span':151 'name':145,206,287 'need':547 'none':481 'offlin':366,369,389,396,404,483,515 'opentelemetri':4,9,18,25,35,50,75,78,83,95,102,161,544 'opentelemetry._logs':222 'opentelemetry.sdk':228,234 'opentelemetry.sdk.metrics':165 'opentelemetry.sdk.metrics.export':169 'opentelemetry.sdk.trace':106,340 'opentelemetry.sdk.trace.export':110 'opentelemetry.sdk.trace.sampling':344 'option':462 'output':568 'paramet':463 'parentbasedtraceidratio':346 'path':387,493 'performancecount':456 'periodicexportingmetricread':171,188 'permiss':589 'pip':45 'pipelin':79,549 'practic':497 'print':154 'processor':137,259 'product':502,520 'provid':127,130,134,186,196,226,252,254,264,266,277,279,362 'py':6 'python':12,28,100,159,218,270,305,319,338,373,398,413 'quick':67 'ratio':358 'read':300 'reader':187,199,200 'record':258 'reliabl':518 'request':210,450 'requir':587 'retri':372,393,408,486 'review':580 'rout':214 'safeti':590 'sampl':332,337,351,357,510 'sampler':355,364,365 'scenario':65 'scope':561 'send':34 'sent':292 'servic':512 'set':224,262,530 'setup':68 'simplespanprocessor':504 'skill':553 'skill-azure-monitor-opentelemetry-exporter-py' 'source-sickn33' 'sovereign':411 'span':136,150,153 'specif':575 'stop':581 'storag':367,370,382,386,390,397,405,484,487,489,492,516 'string':57,122,181,247,303,311,381,402,433,467,471 'substitut':571 'success':593 'tabl':447 'task':557 'telemetri':91,443 'temp':494 'test':577 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'total':211 'trace':36,98,104,354,459 'trace.get':132,143 'trace.set':128,360 'tracer':126,129,133,141,142,144,361 'tracer.start':147 'tracerprovid':108,131,342,363 'traces/spans':449 'treat':566 'true':406 'type':441,444 'unless':545 'use':13,64,66,140,201,283,333,499,506,522,538,551 'valid':576 'var':474 'variabl':53,298 'workload':536 'world':156 'xxx':59,124,183,249,435 'xxx.in.applicationinsights.azure.com':61 'xxx.in.applicationinsights.azure.us':437","prices":[{"id":"13d11830-2e53-4bd0-bed0-e8985f7b176c","listingId":"871dce19-4bcc-418a-915c-032598899ce7","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:32:52.680Z"}],"sources":[{"listingId":"871dce19-4bcc-418a-915c-032598899ce7","source":"github","sourceId":"sickn33/antigravity-awesome-skills/azure-monitor-opentelemetry-exporter-py","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-monitor-opentelemetry-exporter-py","isPrimary":false,"firstSeenAt":"2026-04-18T21:32:52.680Z","lastSeenAt":"2026-04-24T18:50:32.667Z"}],"details":{"listingId":"871dce19-4bcc-418a-915c-032598899ce7","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"azure-monitor-opentelemetry-exporter-py","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34928,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-24T06:41:17Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"99e0d92f8931565a2cce5d4a7bc2aa3c5d66e3e5","skill_md_path":"skills/azure-monitor-opentelemetry-exporter-py/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-monitor-opentelemetry-exporter-py"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"azure-monitor-opentelemetry-exporter-py","description":"Azure Monitor OpenTelemetry Exporter for Python. Use for low-level OpenTelemetry export to Application Insights."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-monitor-opentelemetry-exporter-py"},"updatedAt":"2026-04-24T18:50:32.667Z"}}