-
Notifications
You must be signed in to change notification settings - Fork 192
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
Added Sdk::isDeveloperModeEnabled() helper. #1144
Added Sdk::isDeveloperModeEnabled() helper. #1144
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. |
42a26b7
to
bf21fd4
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1144 +/- ##
============================================
- Coverage 84.28% 84.27% -0.02%
- Complexity 2193 2197 +4
============================================
Files 282 282
Lines 6224 6231 +7
============================================
+ Hits 5246 5251 +5
- Misses 978 980 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
34e6c2c
to
7bbd008
Compare
Can you elaborate on what sort of extra functionality you're thinking of? |
src/SDK/Sdk.php
Outdated
return Configuration::getBoolean(Variables::OTEL_PHP_DEVELOPER_MODE_ENABLED); | ||
} | ||
|
||
try { |
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.
I think it should only be enabled by variable (and default to off). Is there any benefit other than convenience to also checking InstalledVersions?
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.
No, purely the convenience. I will go with your lead here, will remove this dependency/complexity.
It was along the lines of hooking things which may only be available as a dev-dependency, without having to split that into a separate package. The split may be additional overhead, but happy either way. There may not be a strong enough use-case for this and that is fine too! |
7bbd008
to
d997392
Compare
With #1045 in mind, to be able to hook additional classes which may or may not be present. With that particular example, something akin to the below but without the overhead of the if ($devMode && isset(\Illuminate\Foundation\Console\ServeCommand::$passthroughVariables)) {
foreach ($_ENV as $key => $value) {
if (str_starts_with($key, 'OTEL_')) {
\Illuminate\Foundation\Console\ServeCommand::$passthroughVariables[] = $key;
}
}
} |
Gotcha. My understanding of the observer API (mostly from reading https://www.datadoghq.com/blog/engineering/php-8-observability-baked-right-in/#target-functions-and-methods) is that it's very low overhead for methods that aren't called. There's no issue with observing non-existent methods, either (eg if the class is not installed). So, I'm not particularly worried about the overhead of extra hooks. Even so, I think you could wrap the hook with an |
Use case in mind:
Alternative: