Skip to content

Commit

Permalink
Adds metric.enable_command_metric switch (#6272)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia authored Nov 9, 2023
1 parent 2f44242 commit 9d7abda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions publish/metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'default' => env('METRIC_DRIVER', 'prometheus'),
'use_standalone_process' => env('METRIC_USE_STANDALONE_PROCESS', true),
'enable_default_metric' => env('METRIC_ENABLE_DEFAULT_METRIC', true),
'enable_command_metric' => env('METRIC_ENABLE_COMMAND_METRIC', true),
'default_metric_interval' => env('DEFAULT_METRIC_INTERVAL', 5),
'metric' => [
'prometheus' => [
Expand Down
4 changes: 4 additions & 0 deletions src/Listener/OnBeforeHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function process(object $event): void
return;
}

if (! $this->config->get('metric.enable_command_metric', true)) {
return;
}

MetricFactoryPicker::$isCommand = true;

if ($this->config->get('metric.use_standalone_process', true)) {
Expand Down

0 comments on commit 9d7abda

Please sign in to comment.