mirror of
https://github.com/mjl-/mox.git
synced 2024-12-27 08:53:48 +03:00
25 lines
714 B
Go
25 lines
714 B
Go
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()
|
|
}
|