2

I enable profiler SetEnv MAGE_PROFILER html in my conf file for magento 2.

Is there an easy way to profile Magento 2 API REST calls.

2 Answers 2

4

I would recommend to check (even as a trial option) solutions like:

  • Blackfire.io
  • NewRelic
  • xdebug

Those tools will show you exact traces and timing of each separate PHP Trace that is involved within any operation/transaction (not limited to API calls)

For Database related bottlenecks - MySQL Slow Query Log can be enabled (*depends on MySQL Version used). This can be used without mentioned performance monitoring tools

0

What you could do to is add another strpos condition in app/bootstrap.php on rest/V1

if (
    (!empty($_SERVER['MAGE_PROFILER']) || file_exists(BP . '/var/profiler.flag'))
    && isset($_SERVER['HTTP_ACCEPT'])
    && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false || strpos($_SERVER['REQUEST_URI'], 'rest/V1') !== false)
) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.