Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Azure Monitor OpenTelemetry Exporter for Python. Use for low-level OpenTelemetry export to Application Insights.
.claude/skills/azure-monitor-opentelemetry-exporter-py/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | — | — |
| case-01 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✓ | ▲ Improved | — | — |
| case-07 | ✓→✓ | = Same ✓ | — | — |
| case-12 | ✗→✗ | = Same ✗ | — | — |
Low-level exporter for sending OpenTelemetry traces, metrics, and logs to Application Insights.
bashpip install azure-monitor-opentelemetry-exporter
bashAPPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/
| Scenario | Use | |----------|-----| | Quick setup, auto-instrumentation | azure-monitor-opentelemetry (distro) | | Custom OpenTelemetry pipeline | azure-monitor-opentelemetry-exporter (this) | | Fine-grained control over telemetry | azure-monitor-opentelemetry-exporter (this) |
pythonfrom opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter # Create exporter exporter = AzureMonitorTraceExporter( connection_string="InstrumentationKey=xxx;..." ) # Configure tracer provider trace.set_tracer_provider(TracerProvider()) trace.get_tracer_provider().add_span_processor( BatchSpanProcessor(exporter) ) # Use tracer tracer = trace.get_tracer(__name__) with tracer.start_as_current_span("my-span"): print("Hello, World!")
pythonfrom opentelemetry import metrics from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader from azure.monitor.opentelemetry.exporter import AzureMonitorMetricExporter # Create exporter exporter = AzureMonitorMetricExporter( connection_string="InstrumentationKey=xxx;..." ) # Configure meter provider reader = PeriodicExportingMetricReader(exporter, export_interval_millis=60000) metrics.set_meter_provider(MeterProvider(metric_readers=[reader])) # Use meter meter = metrics.get_meter(__name__) counter = meter.create_counter("requests_total") counter.add(1, {"route": "/api/users"})
pythonimport logging from opentelemetry._logs import set_logger_provider from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler from opentelemetry.sdk._logs.export import BatchLogRecordProcessor from azure.monitor.opentelemetry.exporter import AzureMonitorLogExporter # Create exporter exporter = AzureMonitorLogExporter( connection_string="InstrumentationKey=xxx;..." ) # Configure logger provider logger_provider = LoggerProvider() logger_provider.add_log_record_processor(BatchLogRecordProcessor(exporter)) set_logger_provider(logger_provider) # Add handler to Python logging handler = LoggingHandler(level=logging.INFO, logger_provider=logger_provider) logging.getLogger().addHandler(handler) # Use logging logger = logging.getLogger(__name__) logger.info("This will be sent to Application Insights")
Exporters read APPLICATIONINSIGHTS_CONNECTION_STRING automatically:
pythonfrom azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter # Connection string from environment exporter = AzureMonitorTraceExporter()
pythonfrom azure.identity import DefaultAzureCredential from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter exporter = AzureMonitorTraceExporter( credential=DefaultAzureCredential() )
Use ApplicationInsightsSampler for consistent sampling:
pythonfrom opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.sampling import ParentBasedTraceIdRatio from azure.monitor.opentelemetry.exporter import ApplicationInsightsSampler # Sample 10% of traces sampler = ApplicationInsightsSampler(sampling_ratio=0.1) trace.set_tracer_provider(TracerProvider(sampler=sampler))
Configure offline storage for retry:
pythonfrom azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter exporter = AzureMonitorTraceExporter( connection_string="...", storage_directory="/path/to/storage", # Custom storage path disable_offline_storage=False # Enable retry (default) )
pythonexporter = AzureMonitorTraceExporter( connection_string="...", disable_offline_storage=True # No retry on failure )
pythonfrom azure.identity import AzureAuthorityHosts, DefaultAzureCredential from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter # Azure Government credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) exporter = AzureMonitorTraceExporter( connection_string="InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.us/", credential=credential )
| Exporter | Telemetry Type | Application Insights Table | |----------|---------------|---------------------------| | AzureMonitorTraceExporter | Traces/Spans | requests, dependencies, exceptions | | AzureMonitorMetricExporter | Metrics | customMetrics, performanceCounters | | AzureMonitorLogExporter | Logs | traces, customEvents |
| Parameter | Description | Default | |-----------|-------------|---------| | connection_string | Application Insights connection string | From env var | | credential | Azure credential for AAD auth | None | | disable_offline_storage | Disable retry storage | False | | storage_directory | Custom storage path | Temp directory |
azure-monitor-opentelemetry) unless you need custom pipelines| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.