RepoMicrosoftMicrosoftpublished Mar 27, 2026seen 1w

microsoft/opentelemetry-distro-python

Python

Open original ↗

Captured source

source ↗

microsoft/opentelemetry-distro-python

Description: Microsoft OpenTelemetry Distro repository

Language: Python

License: NOASSERTION

Stars: 0

Forks: 9

Open issues: 6

Created: 2026-03-27T16:25:18Z

Pushed: 2026-06-16T04:47:16Z

Default branch: main

Fork: no

Archived: no

README:

microsoft-opentelemetry

Python package for a Microsoft OpenTelemetry distribution that provides a single onboarding experience for observability across Azure Monitor, OTLP-compatible backends, and Microsoft Agent 365 integrations.

Getting Started

Prerequisites

Install the Package

pip install microsoft-opentelemetry

Quick Start

Use use_microsoft_opentelemetry to set up instrumentation for your application. All passed-in parameters take priority over any related environment variables.

Azure Monitor:

from microsoft.opentelemetry import use_microsoft_opentelemetry

use_microsoft_opentelemetry(
enable_azure_monitor=True,
azure_monitor_connection_string="InstrumentationKey=...;IngestionEndpoint=...",
)

The connection string can also be set via APPLICATIONINSIGHTS_CONNECTION_STRING env var. For Entra-based auth:

from azure.identity import DefaultAzureCredential

use_microsoft_opentelemetry(
enable_azure_monitor=True,
azure_monitor_connection_string="InstrumentationKey=...;IngestionEndpoint=...",
azure_monitor_exporter_credential=DefaultAzureCredential(),
)

Agent 365:

from microsoft.opentelemetry import use_microsoft_opentelemetry

use_microsoft_opentelemetry(
enable_a365=True,
a365_token_resolver=my_token_resolver,
)

Both + OTLP:

# Set OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 for OTLP
use_microsoft_opentelemetry(
enable_azure_monitor=True,
enable_a365=True,
a365_token_resolver=my_token_resolver,
)

See the A365 guide for A365-specific configuration.

---

Configuration Reference

All Options

| Keyword argument | Type | Default | Description | |---|---|---|---| | General | | | | | disable_logging | bool | False | Disable the logging pipeline. | | disable_tracing | bool | False | Disable the tracing pipeline. | | disable_metrics | bool | False | Disable the metrics pipeline. | | resource | Resource | auto | OpenTelemetry Resource. | | span_processors | list | [] | Additional span processors. | | log_record_processors | list | [] | Additional log record processors. | | metric_readers | list | [] | Additional metric readers. | | views | list | [] | Metric views. | | logger_name | str | None | Logger name for log collection. | | logging_formatter | Formatter | None | Formatter for collected logs. | | instrumentation_options | dict | None | Per-library instrumentation enable/disable options. | | enable_trace_based_sampling_for_logs | bool | False | Enable trace-based sampling for logs. | | enable_console | bool | False | Console exporter (dev only). Auto-enables when no other exporter is active. | | enable_sensitive_data | bool | False | Enable sensitive data recording (prompts, tool arguments, results) for Agent Framework SDK instrumentation. | | Azure Monitor | | | | | enable_azure_monitor | bool | False | Enable Azure Monitor export. | | azure_monitor_connection_string | str | None | Connection string. Also read from APPLICATIONINSIGHTS_CONNECTION_STRING. | | azure_monitor_exporter_credential | TokenCredential | None | Azure AD token credential. | | azure_monitor_enable_live_metrics | bool | True | Enable live metrics. | | azure_monitor_enable_performance_counters | bool | True | Enable performance counters. | | azure_monitor_exporter_disable_offline_storage | bool | False | Disable offline retry storage. | | azure_monitor_exporter_storage_directory | str | None | Custom offline storage directory. | | azure_monitor_browser_sdk_loader_config | dict | None | Browser SDK loader configuration. | | Agent 365 | | | | | enable_a365 | bool | False | Enable A365 telemetry export. | | a365_token_resolver | Callable | None | (agent_id, tenant_id) -> token callable. If omitted, defaults to FIC/DefaultAzureCredential. Ignored when a365_contextual_token_resolver is also set. | | a365_contextual_token_resolver | Callable | None | (TokenResolverContext) -> token callable. Receives rich context — agent ID, agentic user ID (AAD Object ID, extracted from the microsoft.agent.user.id span attribute), and tenant ID — at export time. Takes precedence over a365_token_resolver when both are set. | | a365_cluster_category | str | "prod" | Cluster category (prod, gov, dod, mooncake). | | a365_use_s2s_endpoint | bool | False | Use the S2S endpoint. | | a365_suppress_invoke_agent_input | bool | False | Strip input messages from InvokeAgent spans. | | a365_enable_observability_exporter | bool | None | Enable the A365 HTTP exporter. Also read from ENABLE_A365_OBSERVABILITY_EXPORTER env var. Defaults to false when neither is set. | | a365_observability_scope_override | str | None | Override the default Entra scope used by the built-in token resolvers. Also read from A365_OBSERVABILITY_SCOPE_OVERRIDE. | | a365_max_queue_size | int | 2048 | Maximum queue size for the A365 batch span processor. | | a365_scheduled_delay_ms | int | 5000 | Delay between A365 export batches (ms). | | a365_exporter_timeout_ms | int | 30000 | Timeout for a single A365 export operation (ms). | | a365_max_export_batch_size | int | 512 | Maximum batch size for a single A365 export operation. |

> For A365 token resolver patterns, baggage, and scope classes, see the A365 guide.

Sampling

Configured via standard OpenTelemetry environment variables:

| Environment variable | Description | |---|---| | OTEL_TRACES_SAMPLER | Sampler type (see values below). | |...

Excerpt shown — open the source for the full document.

Notability

notability 4.0/10

Routine new repo for observability distro, no traction indicated.