Closed Karstedt-019 closed 3 years ago
@Karstedt-019 - Thanks for the report. Something must have changed. I will take a look.
@Karstedt-019 - Per the code, that line is just a warning / comment. It doesn't actually prevent the profiler flag file from being created. Do you know how you configured the profiler in the XML file? You may wish to check the file you placed in the Magento var
directory (i.e. var/holdenovi_profiler.xml
), and look for the <trigger>
node. If it's still set to parameter, you will have to append a URL parameter on the page you wish to profile. Example: www.yoursite.test?profile=1
.
Anyhow, I tested this on Magento 2.4.2, and it is working. Just be sure that you copied the config file into var
(that file is important for the profiler being able to pull config values before Magento is even fully initialized). If that file is not there, the profiler will never capture anything.
Can you try the above and let me know how it works for you?
I have the xml file set to 'always'.
I removed it completely and then re-added the module and ignored the profiler:enable and got it partially working. Entries show in the backend profiler menu but when I view them it has an error:
TypeError: end() expects parameter 1 to be array, null given in /releases/2/app/code/Holdenovi/Profiler/Model/Data/Run.php:256 Stack trace: #0 /releases/2/app/code/Holdenovi/Profiler/Model/Data/Run.php(256): end(NULL) #1 /releases/2/app/code/Holdenovi/Profiler/Block/Run/Tree.php(190): Holdenovi\Profiler\Model\Data\Run->processRawData() #2 /releases/2/vendor/magento/framework/View/Element/AbstractBlock.php(1111): Holdenovi\Profiler\Block\Run\Tree->_toHtml() #3 /releases/2/vendor/magento/framework/View/Element/AbstractBlock.php(1115): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() #4 /releases/2/vendor/magento/framework/View/Element/AbstractBlock.php(675): Magento\Framework\View\Element\AbstractBlock->_loadCache() #5 /releases/2/vendor/magento/framework/View/Layout.php(566): Magento\Framework\View\Element\AbstractBlock->toHtml() #6 /releases/2/vendor/magento/framework/View/Layout.php(542): Magento\Framework\View\Layout->_renderBlock('holdenovi.profi...') #7 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('holdenovi.profi...') #8 /releases/2/vendor/magento/framework/View/Element/AbstractBlock.php(522): Magento\Framework\View\Layout->renderElement('holdenovi.profi...', true) #9 /releases/2/app/code/Holdenovi/Profiler/view/adminhtml/templates/view.phtml(43): Magento\Framework\View\Element\AbstractBlock->getChildHtml('holdenovi.profi...') #10 /releases/2/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/home/schnapco/...') #11 /releases/2/vendor/magento/framework/View/Element/Template.php(273): Magento\Framework\View\TemplateEngine\Php->render(Object(Holdenovi\Profiler\Block\Run), '/home/schnapco/...', Array) #12 /releases/2/vendor/magento/framework/View/Element/Template.php(303): Magento\Framework\View\Element\Template->fetchView('/home/schnapco/...') #13 /releases/2/vendor/magento/module-backend/Block/Template.php(141): Magento\Framework\View\Element\Template->_toHtml() #14 /releases/2/vendor/magento/framework/View/Element/AbstractBlock.php(1111): Magento\Backend\Block\Template->_toHtml() #15 /releases/2/vendor/magento/framework/View/Element/AbstractBlock.php(1115): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() #16 /releases/2/vendor/magento/framework/View/Element/AbstractBlock.php(675): Magento\Framework\View\Element\AbstractBlock->_loadCache() #17 /releases/2/vendor/magento/framework/View/Layout.php(566): Magento\Framework\View\Element\AbstractBlock->toHtml() #18 /releases/2/vendor/magento/framework/View/Layout.php(542): Magento\Framework\View\Layout->_renderBlock('holdenovi.profi...') #19 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('holdenovi.profi...') #20 /releases/2/vendor/magento/framework/View/Layout.php(594): Magento\Framework\View\Layout->renderElement('holdenovi.profi...', false) #21 /releases/2/vendor/magento/framework/View/Layout.php(544): Magento\Framework\View\Layout->_renderContainer('content', false) #22 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('content') #23 /releases/2/vendor/magento/framework/View/Layout.php(594): Magento\Framework\View\Layout->renderElement('content', false) #24 /releases/2/vendor/magento/framework/View/Layout.php(544): Magento\Framework\View\Layout->_renderContainer('main.col', false) #25 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('main.col') #26 /releases/2/vendor/magento/framework/View/Layout.php(594): Magento\Framework\View\Layout->renderElement('main.col', false) #27 /releases/2/vendor/magento/framework/View/Layout.php(544): Magento\Framework\View\Layout->_renderContainer('admin.scope.col...', false) #28 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('admin.scope.col...') #29 /releases/2/vendor/magento/framework/View/Layout.php(594): Magento\Framework\View\Layout->renderElement('admin.scope.col...', false) #30 /releases/2/vendor/magento/framework/View/Layout.php(544): Magento\Framework\View\Layout->_renderContainer('page.main.conta...', false) #31 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('page.main.conta...') #32 /releases/2/vendor/magento/framework/View/Layout.php(594): Magento\Framework\View\Layout->renderElement('page.main.conta...', false) #33 /releases/2/vendor/magento/framework/View/Layout.php(544): Magento\Framework\View\Layout->_renderContainer('page.content', false) #34 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('page.content') #35 /releases/2/vendor/magento/framework/View/Layout.php(594): Magento\Framework\View\Layout->renderElement('page.content', false) #36 /releases/2/vendor/magento/framework/View/Layout.php(544): Magento\Framework\View\Layout->_renderContainer('page.wrapper', false) #37 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper') #38 /releases/2/vendor/magento/framework/View/Layout.php(594): Magento\Framework\View\Layout->renderElement('page.wrapper', false) #39 /releases/2/vendor/magento/framework/View/Layout.php(544): Magento\Framework\View\Layout->_renderContainer('backend.page', false) #40 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('backend.page') #41 /releases/2/vendor/magento/framework/View/Layout.php(594): Magento\Framework\View\Layout->renderElement('backend.page', false) #42 /releases/2/vendor/magento/framework/View/Layout.php(544): Magento\Framework\View\Layout->_renderContainer('root', false) #43 /releases/2/vendor/magento/framework/View/Layout.php(497): Magento\Framework\View\Layout->renderNonCachedElement('root') #44 /releases/2/vendor/magento/framework/View/Layout.php(963): Magento\Framework\View\Layout->renderElement('root') #45 /releases/2/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout->getOutput() #46 /releases/2/vendor/magento/framework/View/Result/Page.php(258): Magento\Framework\View\Layout\Interceptor->getOutput() #47 /releases/2/vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor)) #48 /releases/2/generated/code/Magento/Backend/Model/View/Result/Page/Interceptor.php(23): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor)) #49 /releases/2/vendor/magento/framework/App/Http.php(120): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor)) #50 /releases/2/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http->launch() #51 /releases/2/pub/index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http)) #52 {main}
What might interfere with the array it's expecting?
@Karstedt-019 - Sadly, since I can't duplicate this, I won't be able to determine that without some of the stack data from the record you are trying to view. Can you post perhaps the first one hundred or so characters from the stack_data
field from a record that will not display? See the holdenovi_profiler_run
SQL record. I'd like to see if anything jumps out or seems odd.
Also, just a note: setting the config value to always
grabs everything, even AJAX requests and admin requests, which may give you a lot of data that you are not necessarily needing.
The bin files from the SQL record are all nearly blank, they just have this:
a:0:{}
I've got it on always because I'm specifically after the ajax reqs. Tried another profiler toolbar that wouldn't grab them.
Note: I'm running the module from app/code/Holdenovi... not vendor. Composer installed the module to both locations so I removed the vendor one.
Update: I think the empty results and error were happening with dev:profiler:disabled... right now when I enable with the custom class the frontend just dies with 500 error. Request for / comes in to nginx and it returns nothing until dev:profiler:disabled, than back to normal.
@Karstedt-019 - Yeah, I did fix the composer.json, including PHP requirements, so that should be fixed if anyone else installs via composer.
I did some local debugging, and I am starting to think this is an issue with the PHP serialize method in the observer class. If there was no data in the profiler stack, there is no way that a record would be written to the database.
I will work on switching to using JSON for serialization, rather than PHP serialize (which was a leftover from the M1 module). I may not finish this in time for this to be of use to you, but I will post here when I tag a new release, which I hope will be within the next few days.
Thanks.
@perryholden - No worries, I'll give it a try when you update.
@Karstedt-019 - Apologies for not following up sooner. I've decided not to proceed with using JSON as opposed to serialized. I've tested this with pretty much every Magento version up to 2.4.3, regardless of site size or code complexity, and I've yet to duplicate this. There is probably something else going on specific to your instance.
You've probably moved on from this, but since you mentioned encountering a 500 error, then I'd search the PHP logs for any entries that tell what specifically went wrong.
I'm going to close this issue, as this was originally about not being able to enable "custom type," but if you ever want to open another issue specifically for the 500 error, please do so.
I'm on mage 2.4.1 and php 7.3 so not within what your module wants, but I thought I'd report anyway.
The command to enable bin/magento dev:profiler:enable '{"drivers":[{"type":"Holdenovi\Profiler\Driver\Hierarchy"}]}'
Returns Type {"drivers":[{"type":"Holdenovi\Profiler\Driver\Hierarchy"}]} is not one of the built-in output types (html, csvfile).
I've never used a custom profiler so can't really provide any insight other than it doesn't work. It's enabled and I've got the admin sections all displaying. Just can't seem to initiate that profiler type