Skip to content

Commit

Permalink
feat: add UeAuthentication metrics counters
Browse files Browse the repository at this point in the history
Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
  • Loading branch information
dariofaccin committed Oct 4, 2024
1 parent ed78d88 commit c5775ec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions producer/generate_auth_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/omec-project/openapi/models"
udm_context "github.com/omec-project/udm/context"
"github.com/omec-project/udm/logger"
stats "github.com/omec-project/udm/metrics"
"github.com/omec-project/udm/util"
"github.com/omec-project/util/httpwrapper"
"github.com/omec-project/util/milenage"
Expand Down Expand Up @@ -85,15 +86,18 @@ func HandleGenerateAuthDataRequest(request *httpwrapper.Request) *httpwrapper.Re
supiOrSuci := request.Params["supiOrSuci"]
response, problemDetails := GenerateAuthDataProcedure(authInfoRequest, supiOrSuci)
if response != nil {
stats.IncrementUdmUeAuthenticationStats("create", "SUCCESS")
// status code is based on SPEC, and option headers
return httpwrapper.NewResponse(http.StatusOK, nil, response)
} else if problemDetails != nil {
stats.IncrementUdmUeAuthenticationStats("create", "FAILURE")
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}
problemDetails = &models.ProblemDetails{
Status: http.StatusForbidden,
Cause: "UNSPECIFIED",
}
stats.IncrementUdmUeAuthenticationStats("create", "FAILURE")
return httpwrapper.NewResponse(http.StatusForbidden, nil, problemDetails)
}

Expand All @@ -106,8 +110,10 @@ func HandleConfirmAuthDataRequest(request *httpwrapper.Request) *httpwrapper.Res
problemDetails := ConfirmAuthDataProcedure(authEvent, supi)

if problemDetails != nil {
stats.IncrementUdmUeAuthenticationStats("create", "FAILURE")
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
} else {
stats.IncrementUdmUeAuthenticationStats("create", "SUCCESS")
return httpwrapper.NewResponse(http.StatusCreated, nil, nil)
}
}
Expand Down

0 comments on commit c5775ec

Please sign in to comment.