This commit is contained in:
Mechiel Lukkien
2023-01-30 14:27:06 +01:00
commit cb229cb6cf
1256 changed files with 491723 additions and 0 deletions

25
metrics/auth.go Normal file
View File

@ -0,0 +1,25 @@
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
metricAuthentication = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "mox_authentication_total",
Help: "Authentication attempts and results.",
},
[]string{
"kind", // submission, imap, httpaccount, httpadmin
"variant", // login, plain, scram-sha-256, httpbasic
// todo: we currently only use badcreds, but known baduser can be helpful
"result", // ok, baduser, badpassword, badcreds, error, aborted
},
)
)
func AuthenticationInc(kind, variant, result string) {
metricAuthentication.WithLabelValues(kind, variant, result).Inc()
}