subhh / vufind-solrprobe
VuFindSearch listener that collects information about the interaction with the search server
Package info
gitlab-ce.rrz.uni-hamburg.de/subhh/public/vufind-solrprobe.git
pkg:composer/subhh/vufind-solrprobe
Requires (Dev)
- ahand/mobileesp: dev-master
- vufind/vufind: ^10.2
README
SolrProbe is copyright (c) by Staats- und Universitätsbibliothek Hamburg and released under the terms of the GNU General Public License v3.
Description
SolrProbe hooks into VuFind's search system and collects information about the interaction with the search server. It gathers the following information:
- Backend identifier
- Name of the search command class
- Duration between
.preand.post/.errorevent - Processing time as reported by Solr
- Request status ("OK" or the exception class name)
- Request status code ("200" or the exception code)
In addition, the SolrProbe can be instantiated with a class that provides addition context information. See the
LegacyContextProvider for an example implementation of a context provider class.
Usage
Attach the SolrProbe to the shared event manager during the Laminas MVC `bootstrap` event.
class Module {
...
public function onBootStrap (MvcEvent $event) : void
{
$filename = sprintf('probe.log.%s', date('Y-m-d'));
$logfile = fopen(__DIR__ . '/log/' . $filename, 'a');
if ($logfile !== false) {
$services = $event->getApplication()->getServiceManager();
$events = $services->get('SharedEventManager');
$handler = new SUBHH\VuFind\SolrProbe\LogfileHandler($logfile);
$probe = new SUBHH\VuFind\SolrProbe\SolrProbe($handler);
$probe->attach($events);
register_shutdown_function([$probe, 'onEngineShutdown']);
}
...
}
Authors
David Maus <david.maus@sub.uni-hamburg.de>