Problem/Motivation
If you have activated the plugin and use drush to perform tasks you get PHP warnings. This seems to be related to the fact that drush dispatches a kernel.terminate event without dispatching a kernel.request event first. This tries to stop a timer that was not created.
$ drush updatedb
[success] No pending updates.
[warning] Undefined array key "prometheus_metrics_request_timer" Timer.php:73
[warning] Undefined array key "prometheus_metrics_request_timer" Timer.php:47
[warning] Trying to access array offset on value of type null Timer.php:47
Steps to reproduce
- Install drush
- Install plugin
- Call any drush command
Proposed resolution
Would suggest checking in the event listener for the terminate event, if we are in CLI context and early return.
Issue fork prometheus_metrics-3231014
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
deranga commented@carstendietrich, thanks for the report and patch, I've reviewed, and merged in. Will be testing and creating a release later today.
Comment #6
deranga commentedComment #7
deranga commentedNew release 1.0.0-alpha7 addresses this.