Passed
Push — master ( fa6214...4cbce0 )
by Biao
03:09
created
src/Components/Prometheus/PrometheusCollectorProcess.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         $taskWorkerNum = isset($swoole->setting['task_worker_num']) ? $swoole->setting['task_worker_num'] : 0;
27 27
         $totalNum = $workerNum + $taskWorkerNum - 1;
28 28
         $workerIds = range(0, $totalNum);
29
-        $runJob = function () use ($swoole, $workerIds, $processCollector, $swooleStatsCollector, $systemCollector) {
29
+        $runJob = function() use ($swoole, $workerIds, $processCollector, $swooleStatsCollector, $systemCollector) {
30 30
             // Collect the metrics of Swoole stats()
31 31
             $swooleStatsCollector->collect();
32 32
 
Please login to merge, or discard this patch.
src/Components/Prometheus/PrometheusExporter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
                 'value' => $apcSmaInfo['avail_mem'],
31 31
             ],
32 32
         ];
33
-        foreach (new \APCuIterator('/^' . $this->config['apcu_key_prefix'] . $this->config['apcu_key_separator'] . '/') as $item) {
33
+        foreach (new \APCuIterator('/^'.$this->config['apcu_key_prefix'].$this->config['apcu_key_separator'].'/') as $item) {
34 34
             $value = apcu_fetch($item['key'], $success);
35 35
             if (!$success) {
36 36
                 continue;
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
         $metrics = $this->getMetrics();
57 57
         $lines = [];
58 58
         foreach ($metrics as $metric) {
59
-            $lines[] = "# HELP " . $metric['name'] . " {$metric['help']}";
60
-            $lines[] = "# TYPE " . $metric['name'] . " {$metric['type']}";
59
+            $lines[] = "# HELP ".$metric['name']." {$metric['help']}";
60
+            $lines[] = "# TYPE ".$metric['name']." {$metric['type']}";
61 61
 
62 62
             $metricLabels = isset($metric['labels']) ? $metric['labels'] : [];
63 63
             $labels = ['{'];
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             }
69 69
             $labels[] = '}';
70 70
             $labelStr = implode('', $labels);
71
-            $lines[] = $metric['name'] . "$labelStr {$metric['value']}";
71
+            $lines[] = $metric['name']."$labelStr {$metric['value']}";
72 72
         }
73 73
         return implode("\n", $lines);
74 74
     }
Please login to merge, or discard this patch.
src/Components/Prometheus/PrometheusServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@
 block discarded – undo
15 15
     public function boot()
16 16
     {
17 17
         $this->publishes([
18
-            __DIR__ . '/../../../config/prometheus.php' => base_path('config/prometheus.php'),
18
+            __DIR__.'/../../../config/prometheus.php' => base_path('config/prometheus.php'),
19 19
         ]);
20 20
     }
21 21
 
22 22
     public function register()
23 23
     {
24 24
         $this->mergeConfigFrom(
25
-            __DIR__ . '/../../../config/prometheus.php', 'prometheus'
25
+            __DIR__.'/../../../config/prometheus.php', 'prometheus'
26 26
         );
27
-        $this->app->singleton(HttpRequestCollector::class, function ($app) {
27
+        $this->app->singleton(HttpRequestCollector::class, function($app) {
28 28
             return new HttpRequestCollector($app['config']->get('prometheus'));
29 29
         });
30
-        $this->app->singleton(SwooleProcessCollector::class, function ($app) {
30
+        $this->app->singleton(SwooleProcessCollector::class, function($app) {
31 31
             return new SwooleProcessCollector($app['config']->get('prometheus'));
32 32
         });
33
-        $this->app->singleton(SwooleStatsCollector::class, function ($app) {
33
+        $this->app->singleton(SwooleStatsCollector::class, function($app) {
34 34
             return new SwooleStatsCollector($app['config']->get('prometheus'));
35 35
         });
36
-        $this->app->singleton(SystemCollector::class, function ($app) {
36
+        $this->app->singleton(SystemCollector::class, function($app) {
37 37
             return new SystemCollector($app['config']->get('prometheus'));
38 38
         });
39
-        $this->app->singleton(PrometheusExporter::class, function ($app) {
39
+        $this->app->singleton(PrometheusExporter::class, function($app) {
40 40
             return new PrometheusExporter($app['config']->get('prometheus'));
41 41
         });
42 42
     }
Please login to merge, or discard this patch.