microsoft.opentelemetry package
Microsoft OpenTelemetry Distro for Python.
Provides a single entry-point — use_microsoft_opentelemetry() —
that initialises OpenTelemetry global providers (tracing, metrics, logging)
and optionally configures Azure Monitor as an exporter.
- microsoft.opentelemetry.use_microsoft_opentelemetry(**kwargs)[source]
Configure OpenTelemetry with optional Azure Monitor support.
This function sets up the OpenTelemetry global providers (TracerProvider, MeterProvider, LoggerProvider) and optionally configures Azure Monitor as an exporter. Azure Monitor is off by default: enable it via
enable_azure_monitor=Trueand provide a connection string.- Keyword Arguments:
enable_azure_monitor (bool) – Enable Azure Monitor export. Defaults to False. Set to True to enable Azure Monitor setup.
azure_monitor_connection_string (str) – Connection string for Application Insights resource.
azure_monitor_exporter_credential – Azure AD token credential for authentication.
azure_monitor_enable_live_metrics (bool) – Enable live metrics. Defaults to True.
azure_monitor_enable_performance_counters (bool) – Enable performance counters. Defaults to True.
azure_monitor_exporter_disable_offline_storage (bool) – Disable offline retry storage. Defaults to False.
azure_monitor_exporter_storage_directory (str) – Custom directory for offline telemetry storage.
azure_monitor_browser_sdk_loader_config (dict) – Browser SDK loader configuration.
disable_logging (bool) – Disable the logging pipeline. Defaults to False.
disable_tracing (bool) – Disable the tracing pipeline. Defaults to False.
disable_metrics (bool) – Disable the metrics pipeline. Defaults to False.
resource – 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) – Logger name for log collection.
logging_formatter – Formatter for collected logs.
instrumentation_options (dict) – Per-library instrumentation enable/disable options.
enable_trace_based_sampling_for_logs (bool) – Enable trace-based sampling for logs.
enable_a365 (bool) – Enable Agent365 trace export. Defaults to False.
a365_token_resolver – Optional callable
(agent_id: str, tenant_id: str) -> str | Noneused to authenticate with the Agent365 endpoint. When omitted,DefaultAzureCredentialis used.a365_cluster_category (str) – Cluster category for endpoint discovery. Also read from
A365_CLUSTER_CATEGORYenv var. Defaults to"prod".a365_use_s2s_endpoint (bool) – Use the S2S endpoint. Also read from
A365_USE_S2S_ENDPOINTenv var. Defaults to False.a365_suppress_invoke_agent_input (bool) – Strip input messages from InvokeAgent spans before export. Also read from
A365_SUPPRESS_INVOKE_AGENT_INPUTenv var. Defaults to False.a365_enable_observability_exporter (bool) – Enable the A365 HTTP observability exporter. Also read from
ENABLE_A365_OBSERVABILITY_EXPORTERenv var. Defaults to False. Has no effect unlessenable_a365=True.a365_observability_scope_override (str) – Override the authentication scope used when acquiring tokens for the A365 observability service. Equivalent to setting the
A365_OBSERVABILITY_SCOPE_OVERRIDEenvironment variable. When provided, this kwarg overrides the env var.a365_max_queue_size (int) – Maximum queue size for the A365 batch span processor. Defaults to 2048 when omitted (BatchSpanProcessor default).
a365_scheduled_delay_ms (int) – Delay between A365 export batches in milliseconds. Defaults to 5000 when omitted (BatchSpanProcessor default).
a365_exporter_timeout_ms (int) – Timeout for a single A365 export operation in milliseconds. Defaults to 30000 when omitted (BatchSpanProcessor default).
a365_max_export_batch_size (int) – Maximum batch size for a single A365 export operation. Defaults to 512 when omitted (BatchSpanProcessor default).
enable_console (bool) – Enable console exporter for traces, metrics, and logs (development only). Mirrors
ExportTarget.Consolefrom the .NET distro. Auto-enables when no other exporter is active (Azure Monitor off, OTLP off, A365 off). Defaults to False.enable_spectra (bool) – Enable Spectra Collector sidecar export via OTLP. Defaults to False. Requires
opentelemetry-exporter-otlp-proto-grpcfor gRPC protocol; falls back to HTTP if gRPC is unavailable. Logs a warning and skips if neither exporter package is installed.spectra_endpoint (str) – Spectra sidecar OTLP endpoint. Also read from
SPECTRA_ENDPOINTenv var. Defaults tohttp://localhost:4317for gRPC orhttp://localhost:4318for HTTP.spectra_protocol (str) – OTLP protocol for Spectra —
"grpc"or"http". Also read fromSPECTRA_PROTOCOLenv var. Defaults to"grpc".spectra_insecure (bool) – Use insecure (no TLS) connection. Defaults to True (localhost sidecar).
enable_sensitive_data (bool) – Enable sensitive data recording (prompts, tool arguments, results) for the Agent Framework SDK instrumentation. Defaults to False.
- Return type:
None
Subpackages
- microsoft.opentelemetry.a365 package
- Subpackages
- microsoft.opentelemetry.a365.core package
OpenTelemetryScopeExecuteToolScopeInvokeAgentScopeInferenceScopeOutputScopeBaggageBuilderInvokeAgentScopeDetailsAgentDetailsCallerDetailsUserDetailsToolCallDetailsChannelRequestResponseSpanDetailsInferenceCallDetailsServiceEndpointInferenceOperationTypeToolTypeMessageRoleFinishReasonModalityTextPartToolCallRequestPartToolCallResponsePartReasoningPartBlobPartFilePartUriPartServerToolCallPartServerToolCallResponsePartGenericPartChatMessageOutputMessageInputMessagesOutputMessages- Subpackages
- Submodules
- microsoft.opentelemetry.a365.hosting package
- microsoft.opentelemetry.a365.runtime package
- microsoft.opentelemetry.a365.core package
- Submodules
- Subpackages