Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
0b4fbc9d
Commit
0b4fbc9d
authored
4 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
added prometheus exporter to count successfull humanverifications
parent
babf8e73
No related branches found
Branches containing commit
No related tags found
3 merge requests
!1645
Development
,
!1643
Development
,
!1630
Resolve "Make the Cache connection optional"
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Http/Middleware/HumanVerification.php
+6
-1
6 additions, 1 deletion
app/Http/Middleware/HumanVerification.php
app/PrometheusExporter.php
+15
-5
15 additions, 5 deletions
app/PrometheusExporter.php
with
21 additions
and
6 deletions
app/Http/Middleware/HumanVerification.php
+
6
−
1
View file @
0b4fbc9d
...
@@ -139,7 +139,12 @@ class HumanVerification
...
@@ -139,7 +139,12 @@ class HumanVerification
}
else
{
}
else
{
$user
[
"expiration"
]
=
now
()
->
addHours
(
72
);
$user
[
"expiration"
]
=
now
()
->
addHours
(
72
);
}
}
$this
->
setUser
(
$prefix
,
$user
);
try
{
$this
->
setUser
(
$prefix
,
$user
);
\App\PrometheusExporter
::
HumanVerificationSuccessfull
();
}
catch
(
\Exception
$e
)
{
Log
::
error
(
$e
->
getMessage
());
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
app/PrometheusExporter.php
+
15
−
5
View file @
0b4fbc9d
...
@@ -2,24 +2,34 @@
...
@@ -2,24 +2,34 @@
namespace
App
;
namespace
App
;
class
PrometheusExporter
{
class
PrometheusExporter
{
public
static
function
CaptchaShown
()
{
public
static
function
CaptchaShown
()
{
$registry
=
\Prometheus\CollectorRegistry
::
getDefault
();
$registry
=
\Prometheus\CollectorRegistry
::
getDefault
();
$counter
=
$registry
->
getOrRegisterCounter
(
'metager'
,
'captcha_shown'
,
'counts how often the captcha was shown'
,
[]);
$counter
=
$registry
->
getOrRegisterCounter
(
'metager'
,
'captcha_shown'
,
'counts how often the captcha was shown'
,
[]);
$counter
->
inc
();
$counter
->
inc
();
}
}
public
static
function
CaptchaCorrect
()
{
public
static
function
CaptchaCorrect
()
{
$registry
=
\Prometheus\CollectorRegistry
::
getDefault
();
$registry
=
\Prometheus\CollectorRegistry
::
getDefault
();
$counter
=
$registry
->
getOrRegisterCounter
(
'metager'
,
'captcha_correct'
,
'counts how often the captcha was solved correctly'
,
[]);
$counter
=
$registry
->
getOrRegisterCounter
(
'metager'
,
'captcha_correct'
,
'counts how often the captcha was solved correctly'
,
[]);
$counter
->
inc
();
$counter
->
inc
();
}
}
public
static
function
CaptchaAnswered
()
{
public
static
function
CaptchaAnswered
()
{
$registry
=
\Prometheus\CollectorRegistry
::
getDefault
();
$registry
=
\Prometheus\CollectorRegistry
::
getDefault
();
$counter
=
$registry
->
getOrRegisterCounter
(
'metager'
,
'captcha_answered'
,
'counts how often the captcha was answered'
,
[]);
$counter
=
$registry
->
getOrRegisterCounter
(
'metager'
,
'captcha_answered'
,
'counts how often the captcha was answered'
,
[]);
$counter
->
inc
();
$counter
->
inc
();
}
}
}
public
static
function
HumanVerificationSuccessfull
()
\ No newline at end of file
{
$registry
=
\Prometheus\CollectorRegistry
::
getDefault
();
$counter
=
$registry
->
getOrRegisterCounter
(
'metager'
,
'humanverification'
,
'counts how often humanverification middleware was successfull'
,
[]);
$counter
->
inc
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment