mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 07:10:56 +03:00
metrics: reduce complexity for AddLoginResult method
fix a gocyclo warning
This commit is contained in:
@@ -830,9 +830,7 @@ func AddLoginAttempt(authMethod string) {
|
||||
}
|
||||
}
|
||||
|
||||
// AddLoginResult increments the metrics for login results
|
||||
func AddLoginResult(authMethod string, err error) {
|
||||
if err == nil {
|
||||
func incLoginOK(authMethod string) {
|
||||
totalLoginOK.Inc()
|
||||
switch authMethod {
|
||||
case loginMethodPublicKey:
|
||||
@@ -850,7 +848,9 @@ func AddLoginResult(authMethod string, err error) {
|
||||
default:
|
||||
totalPasswordLoginOK.Inc()
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
func incLoginFailed(authMethod string) {
|
||||
totalLoginFailed.Inc()
|
||||
switch authMethod {
|
||||
case loginMethodPublicKey:
|
||||
@@ -868,6 +868,14 @@ func AddLoginResult(authMethod string, err error) {
|
||||
default:
|
||||
totalPasswordLoginFailed.Inc()
|
||||
}
|
||||
}
|
||||
|
||||
// AddLoginResult increments the metrics for login results
|
||||
func AddLoginResult(authMethod string, err error) {
|
||||
if err == nil {
|
||||
incLoginOK(authMethod)
|
||||
} else {
|
||||
incLoginFailed(authMethod)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user