You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request updates the SolarWinds APM PHP SDK to use a new environment variable, SW_APM_AUTOLOAD_ENABLED, for controlling automatic SDK initialization, replacing the previous reliance on OTEL_PHP_AUTOLOAD_ENABLED. Documentation, code, and tests are updated to reflect this change, and some example configurations are simplified. Additionally, minor corrections and clarifications are made to documentation and example files.
Environment Variable and Autoloading Changes:
Introduced the SW_APM_AUTOLOAD_ENABLED environment variable for controlling autoloading, defaulting to true, and updated all references in code, tests, and documentation to use this variable instead of OTEL_PHP_AUTOLOAD_ENABLED. [1][2][3][4][5][6][7][8][9][10][11][12][13]
Updated integration and unit tests to use SW_APM_AUTOLOAD_ENABLED for enabling/disabling autoloading logic. [1][2][3][4][5][6][7][8]
Documentation Updates:
Updated CONFIGURATION.md, README.md, and Azure/WordPress quickstart documentation to reference SW_APM_AUTOLOAD_ENABLED and clarify its usage, removing or updating references to OTEL_PHP_AUTOLOAD_ENABLED. [1][2][3][4][5]
Added a description of SW_APM_AUTOLOAD_ENABLED to the configuration tables and improved language for clarity.
Example and Sample Code Updates:
Removed or updated usage of OTEL_PHP_AUTOLOAD_ENABLED in all example scripts, aligning them with the new default behavior. [1][2][3][4][5][6][7]
Simplified example service key values in sample scripts for clarity. [1][2][3]
Miscellaneous:
Fixed the order of autoload files in composer.json to ensure correct loading sequence.
Cleaned up environment variable documentation in TROUBLESHOOTING.md to remove outdated references.
Added missing import for SolarwindsEnv alias in files where environment variable constants are referenced. [1][2][3]
These changes collectively ensure that the SolarWinds APM PHP SDK uses its own configuration variable for autoloading, improving clarity and reducing confusion with upstream OpenTelemetry variables.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The teardown no longer clears OTEL_PHP_AUTOLOAD_ENABLED, allowing leaked state to make subsequent autoload tests exercise different branches depending on execution order.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The default-enabled startup path lacks targeted fresh-process coverage verifying behavior with both autoload variables unset, including SDK configuration and propagator installation.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Add fresh-process coverage for default-enabled startup
src/SdkAutoloader.php:349
The new default-enabled startup path has no targeted coverage: the tests set explicit true/false values, and PHPUnit loads vendor/autoload.php before test setup. Add a fresh-process test that genuinely unsets both autoload variables before requiring Composer's autoloader. Assert that isEnabled() returns true and the expected SolarWinds SDK configuration and propagators are installed, rather than checking only autoload()'s return value.
The default-enabled startup path lacks targeted fresh-process coverage verifying behavior with both autoload variables unset, including SDK configuration and propagator installation.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Add fresh-process coverage for default-enabled startup src/SdkAutoloader.php:349
The new default-enabled startup path has no targeted coverage: the tests set explicit true/false values, and PHPUnit loads vendor/autoload.php before test setup. Add a fresh-process test that genuinely unsets both autoload variables before requiring Composer's autoloader. Assert that isEnabled() returns true and the expected SolarWinds SDK configuration and propagators are installed, rather than checking only autoload()'s return value.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The tests explicitly enable the SolarWinds flag, leaving default-enabled behavior when SW_APM_AUTOLOAD_ENABLED is genuinely unset unverified and allowing regressions to pass unnoticed.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Add coverage for the unset SolarWinds flag default
tests/Unit/SdkAutoloaderTest.php:40
The new default-enabled behavior is not covered: every test that expects initialization explicitly sets the SolarWinds flag to true. Removing the default argument from isEnabled() could therefore disable initialization for all the updated examples without failing these tests. Please also assert that isEnabled() returns true when SW_APM_AUTOLOAD_ENABLED is genuinely unset (rather than set to an empty string).
The tests explicitly enable the SolarWinds flag, leaving default-enabled behavior when SW_APM_AUTOLOAD_ENABLED is genuinely unset unverified and allowing regressions to pass unnoticed.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Add coverage for the unset SolarWinds flag default tests/Unit/SdkAutoloaderTest.php:40
The new default-enabled behavior is not covered: every test that expects initialization explicitly sets the SolarWinds flag to true. Removing the default argument from isEnabled() could therefore disable initialization for all the updated examples without failing these tests. Please also assert that isEnabled() returns true when SW_APM_AUTOLOAD_ENABLED is genuinely unset (rather than set to an empty string).
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The integration test does not exercise default-on entrypoint initialization in a fresh process or verify that global providers and propagators match the configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the SolarWinds APM PHP SDK to use a new environment variable,
SW_APM_AUTOLOAD_ENABLED, for controlling automatic SDK initialization, replacing the previous reliance onOTEL_PHP_AUTOLOAD_ENABLED. Documentation, code, and tests are updated to reflect this change, and some example configurations are simplified. Additionally, minor corrections and clarifications are made to documentation and example files.Environment Variable and Autoloading Changes:
SW_APM_AUTOLOAD_ENABLEDenvironment variable for controlling autoloading, defaulting totrue, and updated all references in code, tests, and documentation to use this variable instead ofOTEL_PHP_AUTOLOAD_ENABLED. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]SW_APM_AUTOLOAD_ENABLEDfor enabling/disabling autoloading logic. [1] [2] [3] [4] [5] [6] [7] [8]Documentation Updates:
CONFIGURATION.md,README.md, and Azure/WordPress quickstart documentation to referenceSW_APM_AUTOLOAD_ENABLEDand clarify its usage, removing or updating references toOTEL_PHP_AUTOLOAD_ENABLED. [1] [2] [3] [4] [5]SW_APM_AUTOLOAD_ENABLEDto the configuration tables and improved language for clarity.Example and Sample Code Updates:
OTEL_PHP_AUTOLOAD_ENABLEDin all example scripts, aligning them with the new default behavior. [1] [2] [3] [4] [5] [6] [7]Miscellaneous:
composer.jsonto ensure correct loading sequence.TROUBLESHOOTING.mdto remove outdated references.SolarwindsEnvalias in files where environment variable constants are referenced. [1] [2] [3]These changes collectively ensure that the SolarWinds APM PHP SDK uses its own configuration variable for autoloading, improving clarity and reducing confusion with upstream OpenTelemetry variables.
Related issues
NH-130745