Commit cf57f71d authored by Dominik Hebeler's avatar Dominik Hebeler

added humanverification error log

parent 138438ae
...@@ -128,10 +128,11 @@ class HumanVerification ...@@ -128,10 +128,11 @@ class HumanVerification
if ($user["unusedResultPages"] === 50 || ($user["unusedResultPages"] > 50 && $user["unusedResultPages"] % 25 === 0)) { if ($user["unusedResultPages"] === 50 || ($user["unusedResultPages"] > 50 && $user["unusedResultPages"] % 25 === 0)) {
$user["locked"] = true; $user["locked"] = true;
} }
} }
\App\PrometheusExporter::HumanVerificationSuccessfull();
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error($e->getMessage()); Log::error($e->getMessage());
\App\PrometheusExporter::HumanVerificationError();
} finally { } finally {
if ($update && $user != null) { if ($update && $user != null) {
if ($user["whitelist"]) { if ($user["whitelist"]) {
...@@ -141,7 +142,6 @@ class HumanVerification ...@@ -141,7 +142,6 @@ class HumanVerification
} }
try { try {
$this->setUser($prefix, $user); $this->setUser($prefix, $user);
\App\PrometheusExporter::HumanVerificationSuccessfull();
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error($e->getMessage()); Log::error($e->getMessage());
} }
......
...@@ -29,7 +29,14 @@ class PrometheusExporter ...@@ -29,7 +29,14 @@ class PrometheusExporter
public static function HumanVerificationSuccessfull() public static function HumanVerificationSuccessfull()
{ {
$registry = \Prometheus\CollectorRegistry::getDefault(); $registry = \Prometheus\CollectorRegistry::getDefault();
$counter = $registry->getOrRegisterCounter('metager', 'humanverification', 'counts how often humanverification middleware was successfull', []); $counter = $registry->getOrRegisterCounter('metager', 'humanverification_success', 'counts how often humanverification middleware was successfull', []);
$counter->inc();
}
public static function HumanVerificationError()
{
$registry = \Prometheus\CollectorRegistry::getDefault();
$counter = $registry->getOrRegisterCounter('metager', 'humanverification_error', 'counts how often humanverification middleware had an error', []);
$counter->inc(); $counter->inc();
} }
} }
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