-
Notifications
You must be signed in to change notification settings - Fork 67
feat(agent): add support for Yii v2 #848
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #848 +/- ##
==========================================
- Coverage 78.76% 78.73% -0.04%
==========================================
Files 193 193
Lines 27129 27175 +46
==========================================
+ Hits 21369 21396 +27
- Misses 5760 5779 +19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
||
/*EXPECT_ERROR_EVENTS null */ | ||
|
||
/* WordPress mock app */ |
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.
This should've been Yii 🙂 but no bigie, thanks for adding the tests for me!
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.
Good catch!
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.
Addressed with d059d1c.
agent/fw_yii.c
Outdated
/* | ||
* Enable Yii2 instrumentation. | ||
*/ | ||
void nr_yii2_enable(TSRMLS_D) { | ||
NRPRG(framework_version) = 2; |
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.
is this still useful?
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.
Not after c4172d8.
One more question: should the error catching be tested too? |
It should be tested and is tested, just with a tool different than integration tests. That tool is using the actual framework, not the mock. I'll think some more about adding a mock to test error handling in integration tests. |
Further testing uncovered some issues with exception handling when Yii's Exception Handler is disabled. This requires further investigation. |
dc5fa2c
to
25c800e
Compare
25c800e
to
3bddfdf
Compare
|
Can you elaborate on this? I tried it and default PHP error handler was used and errors were catched by the default newrelic implementation. |
3bddfdf
to
3d90b20
Compare
Agent for PHPs 8.0+ uses observer API to hook into Zend Engine, which allows offers better out-of-the-box instrumentation of user exception handler. When observer API is used, there's no need to wrap exception handlers to record errors.
Yii 1.x and Yii 2.x are detected as two distinct frameworks and therefore need their own values in nrframework_t enum. This helps with tracking framework usage through supportability metrics. This approach obsoletes the need to store framework_version.
Agent for PHPs 8.0+ uses observer API to hook into Zend Engine, which allows offers better out-of-the-box instrumentation of user exception handler. When observer API is used, there's no need to wrap exception handlers to record errors.
3d90b20
to
cb19ba7
Compare
* nr_php_is_zval_valid_object already checks for NULL * NR_PHP_WRAPPER_END already ensures NR_PHP_WRAPPER_CALL is called and there's no need to call it earlier
There were two problems which caused the default newrelic implementation not to record errors correctly. One has been resolved with #851 and another with #877. |
Implement Yii v2 instrumentation for auto transaction naming.
Original work by @razvanphp in #823. Fixes #821.