-
Notifications
You must be signed in to change notification settings - Fork 3k
Defensively import and vendor experimental components #41245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR defensively imports and vendors experimental components to prevent crashes when upstream dependencies change. Key changes include:
- Modifying tests to conditionally patch experimental modules via sys.modules.
- Updating dependency versions and import logic in setup.py and _configure.py.
- Vendoring experimental OpenTelemetry code into _utils/instrumentation.py for added resilience.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
sdk/monitor/azure-monitor-opentelemetry/tests/test_configure.py | Updated test patches to use sys.modules for experimental imports testing against breaking changes. |
sdk/monitor/azure-monitor-opentelemetry/setup.py | Upgraded dependency versions for Azure Monitor components and instrumentation libraries. |
sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_utils/instrumentation.py | Added vendored experimental code with proper documentation. |
sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py | Adjusted defensive import logic with try-except blocks for both tracing and logging setups. |
sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md | Documented the changes in the changelog to reflect updated component handling and dependency upgrades. |
"Exception occured when importing Azure SDK Tracing. Please upgrade to the latest OpenTelemetry version: %s.", | ||
ex, | ||
) | ||
except Exception as ex: # pylint: disable=broad-except | ||
_logger.warning( # pylint: disable=do-not-log-exceptions-if-not-debug | ||
"Exception occured when setting Azure SDK Tracing: %s.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in error message: 'occured' should be spelled as 'occurred'.
"Exception occured when importing Azure SDK Tracing. Please upgrade to the latest OpenTelemetry version: %s.", | |
ex, | |
) | |
except Exception as ex: # pylint: disable=broad-except | |
_logger.warning( # pylint: disable=do-not-log-exceptions-if-not-debug | |
"Exception occured when setting Azure SDK Tracing: %s.", | |
"Exception occurred when importing Azure SDK Tracing. Please upgrade to the latest OpenTelemetry version: %s.", | |
ex, | |
) | |
except Exception as ex: # pylint: disable=broad-except | |
_logger.warning( # pylint: disable=do-not-log-exceptions-if-not-debug | |
"Exception occurred when setting Azure SDK Tracing: %s.", |
Copilot uses AI. Check for mistakes.
# This could possibly be due to breaking change in upstream OpenTelemetry | ||
# Advise user to upgrade to latest OpenTelemetry version | ||
_logger.warning( # pylint: disable=do-not-log-exceptions-if-not-debug | ||
"Exception occured when setting up Logging. Please upgrade to the latest OpenTelemetry version: %s.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in error message: 'occured' should be spelled as 'occurred'.
"Exception occured when setting up Logging. Please upgrade to the latest OpenTelemetry version: %s.", | |
"Exception occurred when setting up Logging. Please upgrade to the latest OpenTelemetry version: %s.", |
Copilot uses AI. Check for mistakes.
Conditionally import experimental components to ensure distro does not crash on mismatched dependencies.
This could happen when there are breaking changes in upstream OpenTelemetry or azure.core