magespecialist / mage-chrome-toolbar

Magento Chrome Toolbar for MSP_DevTools
333 stars 42 forks source link

How to handle ajax actions? #18

Open Koc opened 7 years ago

Koc commented 7 years ago

For example we have some ajax action which return json/xml. How it possible to profile it?

phoenix128 commented 7 years ago

We are investigating on it to find a good way to debug it. Do you have any suggestion about that?

Koc commented 7 years ago

Maybe using Symfony's approach: write serialized data + csv index with possibility show info about last N requests. Plus overwrite xmlhttprequest http://symfony.com/blog/new-in-symfony-2-6-ajax-requests-in-the-web-debug-toolbar

Koc commented 7 years ago

see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php for more info

phoenix128 commented 7 years ago

Could be an option. Thank you for your suggestion. We are also investigating in using payloads inside the response headers.

Koc commented 7 years ago

Please do not make response headers too big, it may cause hard to debug errors on webserver/browser side. See https://github.com/Seldaek/monolog/issues/172

phoenix128 commented 7 years ago

That was exactly our concern! This is why we stopped it for a while, but your suggestion could be a better option.

barryvdh commented 7 years ago

In https://github.com/maximebf/php-debugbar we use different approaches:

It then provides a dropdown to switch between requests. Eg. a save action will have 2 items, the POST request and the redirected page. So you can always see what happened on the POST (which is mostly more interesting). And ajax requests will trigger a new item in the dropdown.

phoenix128 commented 7 years ago

@barryvdh , seems a good approach.