-
Notifications
You must be signed in to change notification settings - Fork 63
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(agent): add support for CakePHP 4.x and 5.x #983
base: dev
Are you sure you want to change the base?
Conversation
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #983 +/- ##
==========================================
+ Coverage 78.54% 78.68% +0.14%
==========================================
Files 196 196
Lines 27103 27047 -56
==========================================
- Hits 21287 21281 -6
+ Misses 5816 5766 -50
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
agent/fw_cakephp.c
Outdated
NR_PSTR("Cake\\Core\\Exception\\CakeException::__construct"), | ||
nr_cakephp_problem_4, NULL, NULL); |
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'm not sure this is needed. When Observer API is used to hook into Zend Engine, the agent should do the right thing and record the error on the transaction even though framework installs its own exception handler. See Yii's exception instrumentation here for reference.
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 have experimented with the above and noticed that the error is not recorded as a traced error. Instead, I have added code that retrieves the exception caught by CakePHP's error handler and reports it as a traced error: 86108b5
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.
Leaving information for posterity:
The agent correctly detects that CakePHP registers its default exception handler Cake\Error\ExceptionTrap::handleException
(CakePHP 4.x, CakePHP 5.x). However, that exception handler is used only for uncaught exceptions. In a CakePHP application, exceptions thrown in controller actions are caught in Cake\Error\Middleware\ErrorHandlerMiddleware::process
method (CakePHP 4.x, CakePHP 5.x). Cake\Error\Middleware\ErrorHandlerMiddleware
is part of CakePHP application's default middleware stack (CakePHP 4.x, CakePHP 5.x) so wrapping Cake\Error\Middleware\ErrorHandlerMiddleware::handleException
is the right approach for the agent to record error events for exceptions thrown by controller actions in standard CakePHP applications.
Co-authored-by: Michal Nowacki <[email protected]>
Co-authored-by: Michal Nowacki <[email protected]>
Co-authored-by: Michal Nowacki <[email protected]>
Co-authored-by: Michal Nowacki <[email protected]>
Co-authored-by: Michal Nowacki <[email protected]>
This PR does the following:
nr_txn_suggest_package_supportability_metric
innr_cakephp_enable