Coder Social home page Coder Social logo

Comments (13)

johnbillion avatar johnbillion commented on August 15, 2024 6

@lkraav See https://github.com/johnbillion/query-monitor/tree/json-output. In this branch, QM outputs a qm_json object too. It can, for example, be queried in your browser console with something like qm_json.db_queries.times['get_option()'].calls.

See the commit at cd1bd85 for which files you'll want to start hacking for your own needs.

from query-monitor.

lkraav avatar lkraav commented on August 15, 2024 2

Reactions ^^^^

from query-monitor.

heydonovan avatar heydonovan commented on August 15, 2024 1

Yes! I'd love to see this log to syslog/error_log, or even provide JSON output for automation cases. Time and time again, I'll see themes that break the HTML output, and so I've got to manually view the output through raw HTML (which isn't very fun at all).

from query-monitor.

johnbillion avatar johnbillion commented on August 15, 2024 1

Closing this as fixed. I'm going to open up follow-up issues for further work.

from query-monitor.

johnbillion avatar johnbillion commented on August 15, 2024

Query Monitor 2.6 has greatly increased abstraction. Output is now handled in separate classes from the data collection, which goes a long way to facilitating other methods of output as described above.

More to come, but this is the majority of it.

from query-monitor.

johnbillion avatar johnbillion commented on August 15, 2024

Marking this as complete. The data collection is sufficiently abstracted from the output now. I'm going to work on a persistent log at some point, but it's not too high on my priority list currently.

from query-monitor.

FabianSperrle avatar FabianSperrle commented on August 15, 2024

Any news on the persistent logging? Do I have to get my hands dirty or have you made progress already? 😄

from query-monitor.

johnbillion avatar johnbillion commented on August 15, 2024

@FabianSperrle It's in the pipeline, but no, there's nothing ready yet.

If you want to get your hands a little dirty, there's a very rough and ready implementation in the logger branch which I knocked up ages ago when I needed it. It logs some output to error_log(). Not ideal but handy if you really need it. Also take note of this.

from query-monitor.

lkraav avatar lkraav commented on August 15, 2024

I'm also looking for JSON format output, to automagically send a subset of performance data to outside analytics tools - let's say Google Analytics events for the simplest example.

It doesn't look like this moved a whole lot, so wondering what could be the next step here? How massive is the workload here I wonder? If there was a $$$ bounty on it, how much would someone take this on for?

from query-monitor.

johnbillion avatar johnbillion commented on August 15, 2024

@lkraav This would be relatively simple to implement, the only problem would be that QM still logs some large objects in three places (hooks, JS & CSS, and backtraces).

I'll push some code later this evening that demonstrates how to write an output dispatcher without having to handle every different data collector in QM.

from query-monitor.

lkraav avatar lkraav commented on August 15, 2024

@johnbillion the branch has an initial state of outputting var qm_json = ; syntax error, which looks like $out isn't getting populated correctly for some reason. Is this normal or?

from query-monitor.

johnbillion avatar johnbillion commented on August 15, 2024

Not quite sure what's going on there. Try reloading the page and the qm_json variable should be correctly populated.

from query-monitor.

lkraav avatar lkraav commented on August 15, 2024

Not quite sure what's going on there. Try reloading the page and the qm_json variable should be correctly populated.

@johnbillion I'm not able to get the object to show up. Perhaps backtracing the output is the next step, but this isn't showing anything meaningful.

1 .../wp-includes/plugin.php:525QM_Dispatcher_JSON->dispatch(#1)
2 .../wp-includes/load.php:638do_action(tag)
3 PHP internal callshutdown_action_hook()

→ Called from .../query-monitor.git/dispatchers/JSON.php:46 [QM_Dispatcher_JSON->dispatch()]

from query-monitor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.