Commit 81bffc6e authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

added gauge for timings

parent 97461f84
......@@ -150,6 +150,8 @@ class MetaGerSearch extends Controller
echo ($responsePart);
flush();
}
$requestTime = microtime(true) - $time;
\App\PrometheusExporter::Duration($requestTime, "request_time");
}
public function searchTimings(Request $request, MetaGer $metager)
......
......@@ -354,6 +354,7 @@ class MetaGer
public function parseAdgoal($results)
{
$time = microtime(true);
$publicKey = getenv('adgoal_public');
$privateKey = getenv('adgoal_private');
if ($publicKey === false) {
......@@ -411,6 +412,9 @@ class MetaGer
}
} catch (\ErrorException $e) {
return $results;
} finally {
$requestTime = microtime(true) - $time;
\App\PrometheusExporter::Duration($requestTime, "adgoal");
}
return $results;
......
......@@ -39,4 +39,11 @@ class PrometheusExporter
$counter = $registry->getOrRegisterCounter('metager', 'humanverification_error', 'counts how often humanverification middleware had an error', []);
$counter->inc();
}
public static function Duration($duration, $type)
{
$registry = \Prometheus\CollectorRegistry::getDefault();
$gauge = $registry->getOrRegisterGauge('metager', 'request_time', 'How long does Resultpage load', ['type']);
$gauge->set($duration, [$type]);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment