Apply fixes from StyleCI (#1)
This commit is contained in:
parent
6ad41471c0
commit
b6f4589e48
7 changed files with 22 additions and 7 deletions
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Namespace
|
||||
|
|
|
@ -33,7 +33,7 @@ class PrometheusExporter
|
|||
$this->prometheus = $prometheus;
|
||||
|
||||
foreach ($collectors as $collector) {
|
||||
/** @var CollectorInterface $collector */
|
||||
/* @var CollectorInterface $collector */
|
||||
$this->registerCollector($collector);
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ class PrometheusExporter
|
|||
* Return a collector by name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return CollectorInterface
|
||||
*/
|
||||
public function getCollector($name)
|
||||
|
@ -105,7 +106,9 @@ class PrometheusExporter
|
|||
* @param string $name
|
||||
* @param string $help
|
||||
* @param array $labels
|
||||
*
|
||||
* @return \Prometheus\Counter
|
||||
*
|
||||
* @see https://prometheus.io/docs/concepts/metric_types/#counter
|
||||
*/
|
||||
public function registerCounter($name, $help, $labels = [])
|
||||
|
@ -117,6 +120,7 @@ class PrometheusExporter
|
|||
* Return a counter.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Prometheus\Counter
|
||||
*/
|
||||
public function getCounter($name)
|
||||
|
@ -130,7 +134,9 @@ class PrometheusExporter
|
|||
* @param string $name
|
||||
* @param string $help
|
||||
* @param array $labels
|
||||
*
|
||||
* @return \Prometheus\Counter
|
||||
*
|
||||
* @see https://prometheus.io/docs/concepts/metric_types/#counter
|
||||
*/
|
||||
public function getOrRegisterCounter($name, $help, $labels = [])
|
||||
|
@ -144,7 +150,9 @@ class PrometheusExporter
|
|||
* @param string $name
|
||||
* @param string $help
|
||||
* @param array $labels
|
||||
*
|
||||
* @return \Prometheus\Gauge
|
||||
*
|
||||
* @see https://prometheus.io/docs/concepts/metric_types/#gauge
|
||||
*/
|
||||
public function registerGauge($name, $help, $labels = [])
|
||||
|
@ -156,6 +164,7 @@ class PrometheusExporter
|
|||
* Return a gauge.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Prometheus\Gauge
|
||||
*/
|
||||
public function getGauge($name)
|
||||
|
@ -169,7 +178,9 @@ class PrometheusExporter
|
|||
* @param string $name
|
||||
* @param string $help
|
||||
* @param array $labels
|
||||
*
|
||||
* @return \Prometheus\Gauge
|
||||
*
|
||||
* @see https://prometheus.io/docs/concepts/metric_types/#gauge
|
||||
*/
|
||||
public function getOrRegisterGauge($name, $help, $labels = [])
|
||||
|
@ -184,7 +195,9 @@ class PrometheusExporter
|
|||
* @param string $help
|
||||
* @param array $labels
|
||||
* @param array $buckets
|
||||
*
|
||||
* @return \Prometheus\Histogram
|
||||
*
|
||||
* @see https://prometheus.io/docs/concepts/metric_types/#histogram
|
||||
*/
|
||||
public function registerHistogram($name, $help, $labels = [], $buckets = null)
|
||||
|
@ -196,6 +209,7 @@ class PrometheusExporter
|
|||
* Return a histogram.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Prometheus\Histogram
|
||||
*/
|
||||
public function getHistogram($name)
|
||||
|
@ -210,7 +224,9 @@ class PrometheusExporter
|
|||
* @param string $help
|
||||
* @param array $labels
|
||||
* @param array $buckets
|
||||
*
|
||||
* @return \Prometheus\Histogram
|
||||
*
|
||||
* @see https://prometheus.io/docs/concepts/metric_types/#histogram
|
||||
*/
|
||||
public function getOrRegisterHistogram($name, $help, $labels = [], $buckets = null)
|
||||
|
@ -226,7 +242,7 @@ class PrometheusExporter
|
|||
public function export()
|
||||
{
|
||||
foreach ($this->collectors as $collector) {
|
||||
/** @var CollectorInterface $collector */
|
||||
/* @var CollectorInterface $collector */
|
||||
$collector->collect();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class PrometheusServiceProvider extends ServiceProvider
|
|||
$this->loadRoutesFrom(__DIR__ . '/routes.php');
|
||||
}
|
||||
|
||||
$exporter = $this->app->make(PrometheusExporter::class); /** @var PrometheusExporter $exporter */
|
||||
$exporter = $this->app->make(PrometheusExporter::class); /* @var PrometheusExporter $exporter */
|
||||
foreach (config('prometheus.collectors') as $class) {
|
||||
$collector = $this->app->make($class);
|
||||
$exporter->registerCollector($collector);
|
||||
|
|
|
@ -15,6 +15,7 @@ class StorageAdapterFactory
|
|||
*
|
||||
* @param string $driver
|
||||
* @param array $config
|
||||
*
|
||||
* @return Adapter
|
||||
*/
|
||||
public function make($driver, array $config = [])
|
||||
|
@ -35,6 +36,7 @@ class StorageAdapterFactory
|
|||
* Factory a redis storage adapter.
|
||||
*
|
||||
* @param array $config
|
||||
*
|
||||
* @return Redis
|
||||
*/
|
||||
protected function makeRedisAdapter(array $config)
|
||||
|
|
|
@ -4,7 +4,6 @@ $route = Route::get(
|
|||
config('prometheus.metrics_route_path'),
|
||||
\Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics'
|
||||
)->name('metrics'); /** @var \Illuminate\Routing\Route $route */
|
||||
|
||||
$middleware = config('prometheus.metrics_route_middleware');
|
||||
|
||||
if ($middleware) {
|
||||
|
|
|
@ -31,7 +31,7 @@ class MetricsControllerTest extends TestCase
|
|||
->withArgs([
|
||||
"\n",
|
||||
200,
|
||||
['Content-Type' => RenderTextFormat::MIME_TYPE]
|
||||
['Content-Type' => RenderTextFormat::MIME_TYPE],
|
||||
])
|
||||
->andReturn($response);
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Tests;
|
||||
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prometheus\Storage\APC;
|
||||
use Prometheus\Storage\InMemory;
|
||||
|
|
Loading…
Reference in a new issue