Skip to content

Commit

Permalink
Update PrometheusMiddleware.php
Browse files Browse the repository at this point in the history
  • Loading branch information
menkaff authored May 19, 2021
1 parent 3264050 commit f7caf8c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Middleware/PrometheusMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ public function handle(Request $request, Closure $next): Response
$start = microtime(true);
$response = $next($request);
$duration = microtime(true) - $start;
if (app() instanceof \Illuminate\Foundation\Application) {
$params = $request->route()->parameters();
} elseif (isset($request->route()[2])) {
$params = $request->route()[2];
$route = $request->route();
if (app() instanceof \Illuminate\Foundation\Application && isset($route)) {
$params = $route->parameters();
} elseif (isset($route[2])) {
$params = $route[2];
} else {
$params = [];
}
Expand Down

0 comments on commit f7caf8c

Please sign in to comment.