Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add PCF metrics counters #151

Merged
merged 6 commits into from
Oct 8, 2024

Conversation

dariofaccin
Copy link
Contributor

This PR adds two new 5G specific metrics, pcf_smpolicy and pcf_policy_authorization to exported metrics via Prometheus.
The scope of the metrics is the following:

  • pcf_smpolicy: this metric counts the total number of Session Management policy queries to PCF; the metric stores the query type (create, get, update, delete), the DNN and the result (SUCCESS, FAILURE);
  • pcf_policy_authorization: this metric counts the total number policy authorization queries to PCF; the metric stores the query type (create, get, update, delete), the resource type (application_sessions, events_subscriptions) and the result (SUCCESS, FAILURE).

Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
@thakurajayL thakurajayL self-assigned this Oct 5, 2024
@@ -255,11 +259,18 @@ func createSMPolicyProcedure(request models.SmPolicyContextData) (
func HandleDeleteSmPolicyContextRequest(request *httpwrapper.Request) *httpwrapper.Response {
logger.SMpolicylog.Infoln("handle DeleteSmPolicyContext")
smPolicyID := request.Params["smPolicyId"]
response, problems := getSmPolicyContextProcedure(smPolicyID)
smPolicyDnn := "UNKNOWN_DNN"
if problems != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be response != nil ?
if problem is not nil then response is nil and it would lead to crash.

// status code is based on SPEC, and option headers
return httpwrapper.NewResponse(http.StatusOK, nil, response)
} else if problemDetails != nil {
stats.IncrementPcfSmPolicyStats("get", "UNKNOWN_DNN", "SUCCESS")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not this be FAILURE?

@@ -340,17 +354,25 @@ func HandleUpdateSmPolicyContextRequest(request *httpwrapper.Request) *httpwrapp
logger.SMpolicylog.Infoln("handle UpdateSmPolicyContext")
requestDataType := request.Body.(models.SmPolicyUpdateContextData)
smPolicyID := request.Params["smPolicyId"]
getResponse, getProblemDetails := getSmPolicyContextProcedure(smPolicyID)
smPolicyDnn := "UNKNOWN_DNN"
if getProblemDetails != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. getResponse would be nil if getProblemDetails is not nil.
  2. Can we have consistency in naming these variables?

dariofaccin and others added 2 commits October 8, 2024 09:56
Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
@thakurajayL thakurajayL merged commit 0eb6210 into omec-project:master Oct 8, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants