Repository navigation
Add Microsoft Opentelemetry Distro Configuration - #9
Jackson Weber (JacksonWeber) merged 42 commits into
Conversation
Adds the microsoft.opentelemetry package that wraps azure-monitor-opentelemetry with configure_microsoft_opentelemetry() entry point, supporting Azure Monitor, OTLP, and A365 export paths. Includes unit tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests cover: public API surface, standalone provider setup (tracing, logging, metrics), signal enable/disable flags, OTLP metric reader and exporter config, A365 exporter error handling, Azure Monitor import errors, TracerProvider unwrapping, environment variable configuration, and end-to-end standalone mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove all OTLP, A365, and GenAI exporter/instrumentation code. This PR now adds only the Azure Monitor configuration path and standalone provider setup. OTLP and other export paths will be added in future PRs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove standalone provider setup, instrumentation setup, and helper functions that duplicated what configure_azure_monitor() already handles. The distro now cleanly delegates to azure-monitor-opentelemetry for all provider, exporter, and instrumentation setup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a new microsoft.opentelemetry distro-style package intended to provide a single configure_microsoft_opentelemetry() entry point, delegating Azure Monitor setup to azure-monitor-opentelemetry, along with initial unit/integration tests and a changelog update.
Changes:
- Added
microsoft.opentelemetrypackage with configuration orchestration and Azure Monitor delegation/kwargs remapping. - Added configuration-building utilities/constants/types and a package version constant.
- Added new tests covering API surface, env var behavior, and Azure Monitor delegation/error paths.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| microsoft/opentelemetry/init.py | Exposes configure_microsoft_opentelemetry and __version__. |
| microsoft/opentelemetry/_configure.py | Implements orchestration and delegates to azure.monitor.opentelemetry.configure_azure_monitor. |
| microsoft/opentelemetry/_utils/configurations.py | Builds configuration dict using shared defaults and Microsoft-specific defaults/warnings. |
| microsoft/opentelemetry/_constants.py | Defines Microsoft-specific configuration keys and re-exports shared constants. |
| microsoft/opentelemetry/_types.py | Re-exports shared typing (ConfigurationValue). |
| microsoft/opentelemetry/_version.py | Introduces an internal VERSION constant. |
| microsoft/opentelemetry/_utils/init.py | Adds package marker file. |
| microsoft/init.py | Introduces top-level microsoft package marker. |
| microsoft/tests/test_configure.py | Adds tests for delegation/remapping/filtering behavior. |
| microsoft/tests/test_integration.py | Adds tests for API surface, env var handling, and import error warnings. |
| CHANGELOG.md | Documents the new distro configuration entry point (currently overclaims export-path support). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The microsoft distro's _get_configurations() was re-importing and calling all 16+ _default_* functions from azure-monitor-opentelemetry, but configure_azure_monitor() already calls its own _get_configurations() internally — so all defaults were applied twice. Simplified configure_microsoft_opentelemetry() to only handle the two microsoft-specific concerns: - Connection string resolution and key remapping (azure_monitor_connection_string -> connection_string) - The enable_azure_monitor_export gate (making Azure Monitor optional) All other configuration defaults (resource, sampling, instrumentations, processors, etc.) are now handled solely by configure_azure_monitor(). Removed microsoft/opentelemetry/_utils/ (no longer needed). Updated tests to match simplified flow and fixed pre-existing mock issue with create=True for namespace package patching. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove module-level import of azure.monitor.opentelemetry._constants in _constants.py (caused ModuleNotFoundError in CI) - Define ConfigurationValue locally in _types.py instead of re-importing from azure.monitor.opentelemetry._types - Fix line-too-long pylint warnings in _configure.py and _constants.py - Add pylint inline disables for intentional patterns (import-outside-toplevel, broad-exception-caught) - Auto-format test files with black Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- test_configure.py imports opentelemetry.sdk.resources.Resource which requires opentelemetry-sdk at test time - Update pr-validation.yml to run black/pylint on microsoft/tests/ too Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Rename enable_azure_monitor_export to disable_azure_monitor_exporter with inverted boolean logic (exporter enabled by default) - Add disable_live_metrics and disable_performance_counters kwargs with _remap_disable_to_enable() converting to the enable_* form expected by configure_azure_monitor() - Update README with current API example and config options table - Update CHANGELOG version to 0.1.0b1 with new entries - Add 3 new tests for disable-to-enable remapping (25 total) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Rewrite TestSetupAzureMonitor tests to mock azure.monitor.opentelemetry via sys.modules instead of @patch(create=True), which fails when the azure package is not installed - Fix implicit-str-concat in test_integration.py - Add import-error, no-name-in-module, import-outside-toplevel to global pylint disable list (test-time and optional deps) - Shorten docstrings to fit line-length limit Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move Azure Monitor OpenTelemetry modules from azure/monitor/opentelemetry/ to microsoft/azureMonitor/ namespace. Update configure module and tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bring upstream azure-monitor-opentelemetry tests into the repo organized by scenario per reviewer feedback: - tests/ (root): Microsoft Distro tests - tests/azureMonitor/: Azure Monitor specific tests - autoinstrumentation, browserSdkLoader, diagnostics, utils All imports adapted from azure.monitor.opentelemetry to microsoft.azureMonitor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…able Rename Azure Monitor-specific kwargs in use_microsoft_opentelemetry(): - connection_string -> azure_monitor_connection_string - credential -> azure_monitor_exporter_credential - enable_live_metrics -> azure_monitor_enable_live_metrics - enable_performance_counters -> azure_monitor_enable_performance_counters - disable_offline_storage -> azure_monitor_exporter_disable_offline_storage - storage_directory -> azure_monitor_exporter_storage_directory - browser_sdk_loader_config -> azure_monitor_browser_sdk_loader_config - disable_azure_monitor_exporter -> enable_azure_monitor (inverted) Add comprehensive test covering all config options end-to-end. Remove outdated Current Repository Layout section from README. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update CHANGELOG.md with current kwarg names. Update PLANNING.md references from configure_microsoft_opentelemetry to use_microsoft_opentelemetry. Fix broken absolute paths in README.md links. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-distro-config # Conflicts: # CHANGELOG.md # PLANNING.md # README.md # pyproject.toml # samples/langchain/sample_opentelemetry.py
…-distro-config # Conflicts: # CHANGELOG.md # PLANNING.md # README.md # pyproject.toml # samples/langchain/sample_opentelemetry.py
…m/JacksonWeber/opentelemetry-distro-python into jacksonweber/add-ms-distro-config
…annotations - Add namespace_packages, explicit_package_bases, mypy_path to mypy config to fix 'Source file found twice under different module names' error - Exclude src/microsoft/azureMonitor from mypy (same as pylint) - Add py.typed marker for microsoft.opentelemetry package - Add type annotations to use_microsoft_opentelemetry and _setup_azure_monitor Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Same exclusion as pylint and mypy — these vendored files depend on azure-monitor-opentelemetry and other packages not in dev deps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add opentelemetry-sdk, opentelemetry-api, opentelemetry-instrumentation, azure-monitor-opentelemetry-exporter, and azure-core as dependencies - Remove blanket exclude for src/microsoft/azureMonitor from mypy/pyright - Use mypy per-module overrides to relax type annotation requirements for vendored azureMonitor code and optional django dependency - Add specific pylint message disables for conventions common in vendored code (too-many-args, missing-class-docstring, etc.) - Keep tests/azureMonitor excluded from pylint and pyright (test files that require additional runtime deps not in dev extras) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Leftover stub files with no code and no imports referencing them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…umentation These packages don't ship py.typed markers or type stubs, so mypy reports import-not-found. Add per-module ignore_missing_imports. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pyright doesn't support per-module overrides like mypy. The azureMonitor code has missing type stubs (django, azure.core) and type expression issues that can't be configured away — use pyright's ignore for these vendored files while still type-checking microsoft.opentelemetry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 51 changed files in this pull request and generated 14 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hector Hernandez (hectorhdzg)
left a comment
There was a problem hiding this comment.
We may need to work on top of this, but let's merge so we can work in parallel
This pull request introduces the initial implementation of the
microsoft.opentelemetrydistribution package, providing a unified configuration entry point for OpenTelemetry telemetry collection and export via Azure Monitor, OTLP, and A365. The most significant changes include the addition of the main configuration API, supporting utilities, and comprehensive tests to ensure correct integration and error handling.New Microsoft OpenTelemetry Distribution:
microsoft.opentelemetrypackage with a publicconfigure_microsoft_opentelemetry()entry point that orchestrates configuration for Azure Monitor, OTLP, and A365 export paths. This function handles parameter remapping and delegates setup to theazure-monitor-opentelemetrypackage when appropriate. [1] [2] [3]Configuration and Utilities:
Testing and Validation: