Thanks John for your response and for getting back so quickly!
It works great as far as I can tell. Definitely showing in the menu and the list of queries is working. Now I can know that my use of wp_cache_get is indeed relieving strain on that second DB ??
My main request would be that you put the instructions above into the plugin’s Notes or FAQ sections, where they’d be a lot easier for people to find.
Another would be to add some kind of marker between the two results in the menu. Right now it’s like:
3.79S 62.59MB 0.3245S 138Q 0.5809S 19Q
which works but isn’t clear at all, you have to know/remember that you have two objects going and that’s why you have the extra “S” and “Q” items. Something simple like adding a pipe could go a long way:
3.79S 62.59MB 0.3245S 138Q | 0.5809S 19Q
Alternately something like a database icon before each DB listing could be cool, but also take up more space which isn’t ideal.
Oh yeah last thing is that in the “Queries” listing for the second wpdb instance I see this message:
Extended query information such as the component and affected rows is not available. Query Monitor was unable to symlink its db.php file into place. See this wiki page for more information.
I don’t get that on the first one and it seems like it’s probably related to using the second db feature more than anything.
Thanks! Here’s my filter code for anyone else who finds this and wants an example to work from:
/**
* Hook into Query Monitor plugin to register gv_lingua->db for tracking
*
* @see QM_Collector_DB_Queries::process where the filter is run
* @uses $gv_lingua->db where the lingua wpdb object is stored
* @global object $gv_lingua GV Lingua object which contains the class
* @param array $globals_wpdb Array of db objects that Query Monitor tracks
* @return type
*/
function gv_query_monitor_track_lingua_db($globals_wpdb) {
global $gv_lingua;
/**
* If the lingua db object exists insert it with (meaningless) lingua_db slug
*/
if (is_object($gv_lingua) AND isset($gv_lingua->db) AND is_object($gv_lingua->db))
$globals_wpdb['lingua_db'] = $gv_lingua->db;
return $globals_wpdb;
}
add_filter('qm/collect/db_objects', 'gv_query_monitor_track_lingua_db');