Skip to content

Commit

Permalink
Fixed the spelling of 'interval' (#823)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reasno authored and limingxinleo committed Oct 31, 2019
1 parent c0dd018 commit a0a442c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions publish/metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -27,15 +27,15 @@
'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,
'namespace' => env('APP_NAME', 'skeleton'),
'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' => [
Expand All @@ -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),
],
],
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/InfluxDB/MetricFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Prometheus/MetricFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/StatsD/MetricFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/DBPoolWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/OnMetricFactoryReady.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/OnWorkerStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/QueueWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/RedisPoolWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
}
Expand Down

0 comments on commit a0a442c

Please sign in to comment.