Commit 0b4fbc9d authored by Dominik Hebeler's avatar Dominik Hebeler

added prometheus exporter to count successfull humanverifications

parent babf8e73
......@@ -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());
}
}
}
......
......@@ -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();
}
}
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