-
Notifications
You must be signed in to change notification settings - Fork 193
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
feat: Allow OTEL_PHP_DEBUG_SCOPES_DISABLED as en environment variable #1237
feat: Allow OTEL_PHP_DEBUG_SCOPES_DISABLED as en environment variable #1237
Conversation
Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one. |
Disabling via environment variable should work as expected (unless OTEL_PHP_DEBUG_SCOPES_DISABLED=1 php -r 'require "vendor/autoload.php"; echo OpenTelemetry\Context\Context::getCurrent()->activate()::class, PHP_EOL;' Assuming that you are using
If we want to support |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1237 +/- ##
============================================
- Coverage 83.09% 83.08% -0.02%
+ Complexity 2275 2274 -1
============================================
Files 285 285
Lines 6460 6456 -4
============================================
- Hits 5368 5364 -4
Misses 1092 1092
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
To be consistent with how the SDK checks for variables, can you change the order to be $_SERVER, getenv, ini_get
I think the idea is that because it's inside an assertion, when run with a production configuration that code will not be run. So in effect, you couldn't use DebugScope in a non-assertion environment even if you wanted to. |
Can you add a test to prove what happens if the variable is falsey? I'm assuming that disabled=false === enabled, so there DebugScope should be used in this case. |
Hi 👋
While doing some tests and trying to set
OTEL_PHP_DEBUG_SCOPES_DISABLED
to1
as an environment variable to disable the use ofDebugScope
, it wouldn't work. This is because it wasn't considered.I guess it could have also made sense to use some kind of a
ResolverInterface
, considering both INIs and env var.Also, my personal opinion on this env var is that it could make sense to have it enabled by default (in the next major, being a breaking change), considering that the use of
debug_backtrace
has a non-negligible performance impact.