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

  1. Install drush
  2. Install plugin
  3. 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.

Command icon 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

carstendietrich created an issue. See original summary.

deranga made their first commit to this issue’s fork.

deranga’s picture

@carstendietrich, thanks for the report and patch, I've reviewed, and merged in. Will be testing and creating a release later today.

deranga’s picture

Assigned: Unassigned » deranga
deranga’s picture

Status: Active » Fixed

New release 1.0.0-alpha7 addresses this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.