diff --git a/app/Http/Middleware/HumanVerification.php b/app/Http/Middleware/HumanVerification.php index 1e5f4f73d6f9b6bbb484a89a9811e363d7197f65..730a25c8834624f10c4f145b4893456318be7040 100644 --- a/app/Http/Middleware/HumanVerification.php +++ b/app/Http/Middleware/HumanVerification.php @@ -139,7 +139,12 @@ class HumanVerification } else { $user["expiration"] = now()->addHours(72); } - $this->setUser($prefix, $user); + try { + $this->setUser($prefix, $user); + \App\PrometheusExporter::HumanVerificationSuccessfull(); + } catch (\Exception $e) { + Log::error($e->getMessage()); + } } } diff --git a/app/PrometheusExporter.php b/app/PrometheusExporter.php index 1332e1cf2f5176fbcd91e6b8c704ac7cc692fa9c..8d55c0344c149e13a9185a8cadc53cc30abf03e0 100644 --- a/app/PrometheusExporter.php +++ b/app/PrometheusExporter.php @@ -2,24 +2,34 @@ namespace App; -class PrometheusExporter { +class PrometheusExporter +{ - public static function CaptchaShown() { + public static function CaptchaShown() + { $registry = \Prometheus\CollectorRegistry::getDefault(); $counter = $registry->getOrRegisterCounter('metager', 'captcha_shown', 'counts how often the captcha was shown', []); $counter->inc(); } - public static function CaptchaCorrect() { + public static function CaptchaCorrect() + { $registry = \Prometheus\CollectorRegistry::getDefault(); $counter = $registry->getOrRegisterCounter('metager', 'captcha_correct', 'counts how often the captcha was solved correctly', []); $counter->inc(); } - public static function CaptchaAnswered() { + public static function CaptchaAnswered() + { $registry = \Prometheus\CollectorRegistry::getDefault(); $counter = $registry->getOrRegisterCounter('metager', 'captcha_answered', 'counts how often the captcha was answered', []); $counter->inc(); } -} \ No newline at end of file + public static function HumanVerificationSuccessfull() + { + $registry = \Prometheus\CollectorRegistry::getDefault(); + $counter = $registry->getOrRegisterCounter('metager', 'humanverification', 'counts how often humanverification middleware was successfull', []); + $counter->inc(); + } +}