• Resolved xberg

    (@xberg)


    Hi,

    My main .PHP file calls several ajax php files through javascript, but only performance / queries of the main PHP file is displayed, not that of the ajax files. I have no visibility through QM of how well these ajax files are doing.

    Is there something I can do to get insight through your fantastic plugin into those secondary files?
    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Hey,

    QM provides some overview information for Ajax calls, but not the full and detailed information that you get with regular page views. It’s not documented, so you’re not the first person to ask.

    You can use your browser developer tools to view the HTTP headers in the response. If you’re logged in as a user who can see QM’s output, you’ll see some X-QM-* headers that contain the overview (number and time of queries, page generation time).

    If your Ajax call causes a PHP notice or warning, details will also be included in separate headers.

    Finally, if your Ajax request is called through jQuery, you’ll be able to see details of any PHP errors in the Ajax response directly in your browser console.

    John

    Thread Starter xberg

    (@xberg)

    Hi,
    Thanks for your answer: it’s exciting to know about this secret feature!

    Unfortunately I was unable to find any X-QM* headers. I clicked on every file in my Chrome developer consoler (under Network), including the several ajax-something.php files but there were no X-QM headers. And yes, I was logged in as admin in WP with access to Query Monitor.
    Here’s a screenshot of why I am looking at just so we’re sure I’m in the right spot:
    http://prntscr.com/ejsw5w

    Thanks!

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Yep that’s the right place to look.

    This might be something to do with the path to your Ajax endpoint. Can you do the following please and let me know if the X-QM-* headers are seen in the response?

    * Go to the Posts -> Add New screen in the admin area
    * Enter a title
    * Tab or click into the main content area

    This will trigger an autosave to admin-ajax.php which you can see in the Network tab in your browser developer tools. Hopefully you’ll see the X-QM-* headers in the response.

    If you do, then it may be that your cookies aren’t being sent to the Ajax endpoint on the front end. If not, well, something’s not working right and I don’t know what 🙂

    John

    Thread Starter xberg

    (@xberg)

    John,
    Once again you are the King: absolutely correct. I followed your suggested steps and YES, I get the X-QM headers. So I get the correct headers in the admin panel, but not for my own pages.

    So indeed it’s a cookie problem. All my ajax files are located on the root of my server.

    I then set through Query Monitor the “authentication cookie” hoping this would solve my own cookie problem, but still no success.

    Any thoughts or pointers as to how to make this work?
    Many many thanks,

    • This reply was modified 9 years, 2 months ago by xberg.
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘how do I get ajax performance data?’ is closed to new replies.