This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccount/app/Http/Middleware/StatsdMiddelware.php

32 lines
649 B
PHP
Raw Permalink Normal View History

2019-12-25 17:49:20 +00:00
<?php
namespace App\Http\Middleware;
use Closure;
use Domnikl\Statsd\Client;
class StatsdMiddelware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/* @var $statsd \Domnikl\Statsd\Client */
$statsd = app(Client::class);
$statsd->count("request.all", 1);
/* @var $response \Illuminate\Http\Response */
$response = $next($request);
$statsd->count("request.".$response->getStatusCode(), 1);
return $response;
}
}