diff --git a/publish/metric.php b/publish/metric.php index bb06c31..6db7cf9 100644 --- a/publish/metric.php +++ b/publish/metric.php @@ -16,7 +16,7 @@ 'default' => env('METRIC_DRIVER', 'prometheus'), 'use_standalone_process' => env('METRIC_USE_STANDALONE_PROCESS', true), 'enable_default_metric' => env('METRIC_ENABLE_DEFAULT_METRIC', true), - 'default_metric_inteval' => env('DEFAULT_METRIC_INTEVAL', 5), + 'default_metric_interval' => env('DEFAULT_METRIC_INTERVAL', 5), 'metric' => [ 'prometheus' => [ 'driver' => Hyperf\Metric\Adapter\Prometheus\MetricFactory::class, @@ -27,7 +27,7 @@ 'scrape_path' => env('PROMETHEUS_SCRAPE_PATH', '/metrics'), 'push_host' => env('PROMETHEUS_PUSH_HOST', '0.0.0.0'), 'push_port' => env('PROMETHEUS_PUSH_PORT', '9091'), - 'push_inteval' => env('PROMETHEUS_PUSH_INTEVAL', 5), + 'push_interval' => env('PROMETHEUS_PUSH_INTERVAL', 5), ], 'statsd' => [ 'driver' => Hyperf\Metric\Adapter\StatsD\MetricFactory::class, @@ -35,7 +35,7 @@ 'udp_host' => env('STATSD_UDP_HOST', '127.0.0.1'), 'udp_port' => env('STATSD_UDP_PORT', '8125'), 'enable_batch' => env('STATSD_ENABLE_BATCH', true), - 'push_inteval' => env('STATSD_PUSH_INTEVAL', 5), + 'push_interval' => env('STATSD_PUSH_INTERVAL', 5), 'sample_rate' => env('STATSD_SAMPLE_RATE', 1.0), ], 'influxdb' => [ @@ -46,7 +46,7 @@ 'username' => env('INFLUXDB_USERNAME', ''), 'password' => env('INFLUXDB_PASSWORD', ''), 'dbname' => env('INFLUXDB_DBNAME', true), - 'push_inteval' => env('INFLUXDB_PUSH_INTEVAL', 5), + 'push_interval' => env('INFLUXDB_PUSH_INTERVAL', 5), 'auto_create_db' => env('INFLUXDB_AUTO_CREATE_DB', true), ], ], diff --git a/src/Adapter/InfluxDB/MetricFactory.php b/src/Adapter/InfluxDB/MetricFactory.php index be27f91..b181924 100644 --- a/src/Adapter/InfluxDB/MetricFactory.php +++ b/src/Adapter/InfluxDB/MetricFactory.php @@ -100,7 +100,7 @@ public function handle(): void $username = $this->config->get("metric.metric.{$this->name}.username"); $password = $this->config->get("metric.metric.{$this->name}.password"); $dbname = $this->config->get("metric.metric.{$this->name}.dbname"); - $inteval = (float) $this->config->get("metric.metric.{$this->name}.push_inteval", 5); + $interval = (float) $this->config->get("metric.metric.{$this->name}.push_interval", 5); $create = $this->config->get("metric.metric.{$this->name}.auto_create_db"); $client = new Client($host, $port, $username, $password); $guzzleClient = $this->guzzleClientFactory->create([ @@ -115,7 +115,7 @@ public function handle(): void $database->create(new RetentionPolicy($dbname, '1d', 1, true)); } while (true) { - Coroutine::sleep($inteval); + Coroutine::sleep($interval); $points = []; $metrics = $this->registry->getMetricFamilySamples(); foreach ($metrics as $metric) { diff --git a/src/Adapter/Prometheus/MetricFactory.php b/src/Adapter/Prometheus/MetricFactory.php index 0326e9c..76368fc 100644 --- a/src/Adapter/Prometheus/MetricFactory.php +++ b/src/Adapter/Prometheus/MetricFactory.php @@ -121,11 +121,11 @@ protected function scrapeHandle() protected function pushHandle() { while (true) { - $inteval = (float) $this->config->get("metric.metric.{$this->name}.push_inteval", 5); + $interval = (float) $this->config->get("metric.metric.{$this->name}.push_interval", 5); $host = $this->config->get("metric.metric.{$this->name}.push_host"); $port = $this->config->get("metric.metric.{$this->name}.push_port"); $this->doRequest("{$host}:{$port}", $this->getNamespace(), 'put'); - Coroutine::sleep($inteval); + Coroutine::sleep($interval); } } diff --git a/src/Adapter/StatsD/MetricFactory.php b/src/Adapter/StatsD/MetricFactory.php index 4bc83cc..6870645 100644 --- a/src/Adapter/StatsD/MetricFactory.php +++ b/src/Adapter/StatsD/MetricFactory.php @@ -81,13 +81,13 @@ public function makeHistogram(string $name, ?array $labelNames = []): HistogramI public function handle(): void { $name = $this->config->get('metric.default'); - $inteval = (float) $this->config->get("metric.metric.{$name}.push_inteval", 5); + $interval = (float) $this->config->get("metric.metric.{$name}.push_interval", 5); $batchEnabled = $this->config->get("metric.metric.{$name}.enable_batch") == true; // Block handle from returning. do { if ($batchEnabled) { $this->client->startBatch(); - Coroutine::sleep((int) $inteval); + Coroutine::sleep((int) $interval); $this->client->endBatch(); } else { Coroutine::sleep(5000); diff --git a/src/Listener/DBPoolWatcher.php b/src/Listener/DBPoolWatcher.php index 85b2787..757191e 100644 --- a/src/Listener/DBPoolWatcher.php +++ b/src/Listener/DBPoolWatcher.php @@ -64,8 +64,8 @@ public function process(object $event) ->with('default', (string) $workerId); $config = $this->container->get(ConfigInterface::class); - $timerInteval = $config->get('metric.default_metric_inteval', 5); - Timer::tick($timerInteval * 1000, function () use ($gauge, $pool) { + $timerInterval = $config->get('metric.default_metric_interval', 5); + Timer::tick($timerInterval * 1000, function () use ($gauge, $pool) { $gauge->set((float) $pool->getCurrentConnections()); }); } diff --git a/src/Listener/OnMetricFactoryReady.php b/src/Listener/OnMetricFactoryReady.php index 698fbcf..55e7402 100644 --- a/src/Listener/OnMetricFactoryReady.php +++ b/src/Listener/OnMetricFactoryReady.php @@ -92,8 +92,8 @@ public function process(object $event) ); $server = $this->container->get(Server::class); - $timerInteval = $this->config->get('metric.default_metric_inteval', 5); - Timer::tick($timerInteval * 1000, function () use ($metrics, $server) { + $timerInterval = $this->config->get('metric.default_metric_interval', 5); + Timer::tick($timerInterval * 1000, function () use ($metrics, $server) { $serverStats = $server->stats(); $coroutineStats = Coroutine::stats(); $timerStats = Timer::stats(); diff --git a/src/Listener/OnWorkerStart.php b/src/Listener/OnWorkerStart.php index 1f86aaa..fc0524e 100644 --- a/src/Listener/OnWorkerStart.php +++ b/src/Listener/OnWorkerStart.php @@ -130,8 +130,8 @@ public function process(object $event) ); $server = $this->container->get(Server::class); - $timerInteval = $this->config->get('metric.default_metric_inteval', 5); - Timer::tick($timerInteval * 1000, function () use ($metrics, $server) { + $timerInterval = $this->config->get('metric.default_metric_interval', 5); + Timer::tick($timerInterval * 1000, function () use ($metrics, $server) { $serverStats = $server->stats(); if (function_exists('gc_status')) { $this->trySet('gc_', $metrics, gc_status()); diff --git a/src/Listener/QueueWatcher.php b/src/Listener/QueueWatcher.php index 19dbab6..dedbb13 100644 --- a/src/Listener/QueueWatcher.php +++ b/src/Listener/QueueWatcher.php @@ -70,8 +70,8 @@ public function process(object $event) ->with('default'); $config = $this->container->get(ConfigInterface::class); - $timerInteval = $config->get('metric.default_metric_inteval', 5); - Timer::tick($timerInteval * 1000, function () use ($waiting, $delayed, $failed, $timeout, $queue) { + $timerInterval = $config->get('metric.default_metric_interval', 5); + Timer::tick($timerInterval * 1000, function () use ($waiting, $delayed, $failed, $timeout, $queue) { $info = $queue->info(); $waiting->set((float) $info['waiting']); $delayed->set((float) $info['delayed']); diff --git a/src/Listener/RedisPoolWatcher.php b/src/Listener/RedisPoolWatcher.php index 9aa0b80..0e90d97 100644 --- a/src/Listener/RedisPoolWatcher.php +++ b/src/Listener/RedisPoolWatcher.php @@ -64,8 +64,8 @@ public function process(object $event) ->with('default', (string) $workerId); $config = $this->container->get(ConfigInterface::class); - $timerInteval = $config->get('metric.default_metric_inteval', 5); - Timer::tick($timerInteval * 1000, function () use ($gauge, $pool) { + $timerInterval = $config->get('metric.default_metric_interval', 5); + Timer::tick($timerInterval * 1000, function () use ($gauge, $pool) { $gauge->set((float) $pool->getCurrentConnections()); }); }