Commit 92a8dc7b authored by Dominik Hebeler's avatar Dominik Hebeler

converted exporter back to counter

parent 7c901878
......@@ -123,32 +123,9 @@ class MetaGerSearch extends Controller
}
$registry = \Prometheus\CollectorRegistry::getDefault();
$histogram = $registry->getOrRegisterHistogram('metager', 'result_histogram', 'counts total number of returned results', [], [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]);
$resultCount = sizeof($metager->getResults());
$observeValue = 0;
if($resultCount > 0 && $resultCount <= 10){
$observeValue = 10;
}else if($resultCount <= 20){
$observeValue = 20;
}else if($resultCount <= 30){
$observeValue = 30;
}else if($resultCount <= 40){
$observeValue = 40;
}else if($resultCount <= 50){
$observeValue = 50;
}else if($resultCount <= 60){
$observeValue = 60;
}else if($resultCount <= 70){
$observeValue = 70;
}else if($resultCount <= 80){
$observeValue = 80;
}else if($resultCount <= 90){
$observeValue = 90;
}else if($resultCount > 90){
$observeValue = 100;
}
$histogram->observe($observeValue);
$counter = $registry->getOrRegisterCounter('metager', 'result_counter', 'counts total number of returned results', []);
$counter->incBy(sizeof($metager->getResults()));
return $resultpage;
}
......@@ -240,6 +217,11 @@ class MetaGerSearch extends Controller
$result["finished"] = $finished;
if($newResults > 0){
$registry = \Prometheus\CollectorRegistry::getDefault();
$counter = $registry->getOrRegisterCounter('metager', 'result_counter', 'counts total number of returned results', []);
$counter->incBy($newResults);
}
// Update new Engines
Cache::put("loader_" . $metager->getSearchUid(), $metager->getEngines(), 1 * 60);
return response()->json($result);
......
Markdown is supported
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