Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Route name to configs (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
nope7777 authored and nicja committed Jan 16, 2019
1 parent c0c0258 commit 26842eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 13 additions & 0 deletions config/prometheus.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@

'metrics_route_path' => env('PROMETHEUS_METRICS_ROUTE_PATH', 'metrics'),

/*
|--------------------------------------------------------------------------
| Metrics Route Name
|--------------------------------------------------------------------------
|
| Route Parh name aliase.
|
| This is only applicable if metrics_route_enabled is set to true.
|
*/

'metrics_route_name' => env('PROMETHEUS_METRICS_ROUTE_NAME', 'metrics'),

/*
|--------------------------------------------------------------------------
| Metrics Route Middleware
Expand Down
8 changes: 7 additions & 1 deletion src/routes.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<?php

/** @var \Illuminate\Routing\Route $route */
$route = Route::get(
config('prometheus.metrics_route_path'),
\Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics'
)->name('metrics'); /** @var \Illuminate\Routing\Route $route */
);

if ($name = config('prometheus.metrics_route_name')) {
$route->name($name);
}

$middleware = config('prometheus.metrics_route_middleware');

if ($middleware) {
Expand Down

0 comments on commit 26842eb

Please sign in to comment.