Skip to content
Snippets Groups Projects
Commit 0b4fbc9d authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

added prometheus exporter to count successfull humanverifications

parent babf8e73
No related branches found
No related tags found
3 merge requests!1645Development,!1643Development,!1630Resolve "Make the Cache connection optional"
......@@ -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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment