[HSS] Initial Diameter S6a and Cx metrics

This commit is contained in:
Pau Espin 2024-04-08 17:08:10 +02:00 committed by Sukchan Lee
parent 253b09f589
commit d3a779e715
4 changed files with 105 additions and 11 deletions

View File

@ -39,6 +39,7 @@ static int hss_ogs_diam_cx_fb_cb(struct msg **msg, struct avp *avp,
{
/* This CB should never be called */
ogs_warn("Unexpected message received!");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_CX_RX_UNKNOWN);
return ENOTSUP;
}
@ -66,7 +67,8 @@ static int hss_ogs_diam_cx_uar_cb( struct msg **msg, struct avp *avp,
ogs_assert(msg);
ogs_debug("User-Authorization-Request");
ogs_debug("Rx User-Authorization-Request");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_CX_RX_UAR);
/* Create answer header */
qry = *msg;
@ -250,7 +252,8 @@ static int hss_ogs_diam_cx_mar_cb( struct msg **msg, struct avp *avp,
ogs_assert(msg);
ogs_debug("Multimedia-Auth-Request");
ogs_debug("Rx Multimedia-Auth-Request");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_CX_RX_MAR);
/* Create answer header */
qry = *msg;
@ -627,7 +630,8 @@ static int hss_ogs_diam_cx_sar_cb( struct msg **msg, struct avp *avp,
ogs_assert(msg);
ogs_debug("Server-Assignment-Request");
ogs_debug("Rx Server-Assignment-Request");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_CX_RX_SAR);
/* Create answer header */
qry = *msg;
@ -875,7 +879,8 @@ static int hss_ogs_diam_cx_lir_cb( struct msg **msg, struct avp *avp,
ogs_assert(msg);
ogs_debug("Location-Info-Request");
ogs_debug("Rx Location-Info-Request");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_CX_RX_LIR);
/* Create answer header */
qry = *msg;

View File

@ -58,6 +58,7 @@ static int hss_ogs_diam_s6a_fb_cb(struct msg **msg, struct avp *avp,
{
/* This CB should never be called */
ogs_warn("Unexpected message received!");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_S6A_RX_UNKNOWN);
return ENOTSUP;
}
@ -96,7 +97,8 @@ static int hss_ogs_diam_s6a_air_cb( struct msg **msg, struct avp *avp,
ogs_assert(msg);
ogs_debug("Authentication-Information-Request");
ogs_debug("Rx Authentication-Information-Request");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_S6A_RX_AIR);
/* Create answer header */
qry = *msg;
@ -765,7 +767,8 @@ static int hss_ogs_diam_s6a_ulr_cb( struct msg **msg, struct avp *avp,
ogs_assert(msg);
ogs_debug("Update-Location-Request");
ogs_debug("Rx Update-Location-Request");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_S6A_RX_ULR);
memset(&subscription_data, 0, sizeof(ogs_subscription_data_t));
@ -1032,7 +1035,8 @@ static int hss_ogs_diam_s6a_pur_cb( struct msg **msg, struct avp *avp,
ogs_assert(msg);
ogs_debug("Purge-UE-Request");
ogs_debug("Rx Purge-UE-Request");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_S6A_RX_PUR);
memset(&subscription_data, 0, sizeof(ogs_subscription_data_t));
@ -1167,7 +1171,7 @@ void hss_s6a_send_clr(char *imsi_bcd, char *mme_host, char *mme_realm,
struct sess_state *sess_data = NULL, *svg;
struct session *session = NULL;
ogs_debug("[HSS] Cancel-Location-Request");
ogs_debug("[HSS] Tx Cancel-Location-Request");
/* Create the random value to store with the session */
sess_data = ogs_calloc(1, sizeof(*sess_data));
@ -1276,6 +1280,8 @@ void hss_s6a_send_clr(char *imsi_bcd, char *mme_host, char *mme_realm,
ret = fd_msg_send(&req, hss_s6a_cla_cb, svg);
ogs_assert(ret == 0);
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_S6A_TX_CLR);
/* Increment the counter */
ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0);
ogs_diam_logger_self()->stats.nb_sent++;
@ -1292,7 +1298,8 @@ static void hss_s6a_cla_cb(void *data, struct msg **msg)
struct session *session;
int new;
ogs_debug("[HSS] Cancel-Location-Answer");
ogs_debug("[HSS] Rx Cancel-Location-Answer");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_S6A_RX_CLA);
/* Search the session, retrieve its data */
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
@ -1341,7 +1348,7 @@ int hss_s6a_send_idr(char *imsi_bcd, uint32_t idr_flags, uint32_t subdata_mask)
ogs_subscription_data_t subscription_data;
ogs_debug("[HSS] Insert-Subscriber-Data-Request");
ogs_debug("[HSS] Tx Insert-Subscriber-Data-Request");
memset(&subscription_data, 0, sizeof(ogs_subscription_data_t));
@ -1477,6 +1484,8 @@ int hss_s6a_send_idr(char *imsi_bcd, uint32_t idr_flags, uint32_t subdata_mask)
ret = fd_msg_send(&req, hss_s6a_ida_cb, svg);
ogs_assert(ret == 0);
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_S6A_TX_IDR);
/* Increment the counter */
ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0);
ogs_diam_logger_self()->stats.nb_sent++;
@ -1496,7 +1505,8 @@ static void hss_s6a_ida_cb(void *data, struct msg **msg)
struct session *session;
int new;
ogs_debug("[HSS] Insert-Subscriber-Data-Answer");
ogs_debug("[HSS] Rx Insert-Subscriber-Data-Answer");
hss_metrics_inst_global_inc(HSS_METR_GLOB_CTR_S6A_RX_IDA);
/* Search the session, retrieve its data */
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);

View File

@ -49,6 +49,72 @@ static int hss_metrics_init_spec(ogs_metrics_context_t *ctx,
ogs_metrics_spec_t *hss_metrics_spec_global[_HSS_METR_GLOB_MAX];
ogs_metrics_inst_t *hss_metrics_inst_global[_HSS_METR_GLOB_MAX];
hss_metrics_spec_def_t hss_metrics_spec_def_global[_HSS_METR_GLOB_MAX] = {
/* Global Counters: */
[HSS_METR_GLOB_CTR_CX_RX_UNKNOWN] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "cx_rx_unknown",
.description = "Received Cx unknown messages",
},
[HSS_METR_GLOB_CTR_CX_RX_MAR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "cx_rx_mar",
.description = "Received Cx MAR messages",
},
[HSS_METR_GLOB_CTR_CX_RX_SAR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "cx_rx_sar",
.description = "Received Cx SAR messages",
},
[HSS_METR_GLOB_CTR_CX_RX_UAR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "cx_rx_uar",
.description = "Received Cx UAR messages",
},
[HSS_METR_GLOB_CTR_CX_RX_LIR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "cx_rx_lir",
.description = "Received Cx LIR messages",
},
[HSS_METR_GLOB_CTR_S6A_RX_UNKNOWN] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "s6a_rx_unknown",
.description = "Received s6a unknown messages",
},
[HSS_METR_GLOB_CTR_S6A_RX_AIR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "s6a_rx_air",
.description = "Received s6a AIR messages",
},
[HSS_METR_GLOB_CTR_S6A_RX_CLA] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "s6a_rx_cla",
.description = "Received s6a CLA messages",
},
[HSS_METR_GLOB_CTR_S6A_RX_IDA] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "s6a_rx_ida",
.description = "Received s6a IDA messages",
},
[HSS_METR_GLOB_CTR_S6A_RX_PUR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "s6a_rx_pur",
.description = "Received s6a PUR messages",
},
[HSS_METR_GLOB_CTR_S6A_RX_ULR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "s6a_rx_ulr",
.description = "Received s6a ULR messages",
},
[HSS_METR_GLOB_CTR_S6A_TX_CLR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "s6a_tx_clr",
.description = "Transmitted s6a CLR messages",
},
[HSS_METR_GLOB_CTR_S6A_TX_IDR] = {
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
.name = "s6a_tx_idr",
.description = "Transmitted s6a IDR messages",
},
/* Global Gauges: */
[HSS_METR_GLOB_GAUGE_IMSI] = {
.type = OGS_METRICS_METRIC_TYPE_GAUGE,

View File

@ -9,6 +9,19 @@ extern "C" {
/* GLOBAL */
typedef enum hss_metric_type_global_s {
HSS_METR_GLOB_CTR_CX_RX_UNKNOWN,
HSS_METR_GLOB_CTR_CX_RX_MAR,
HSS_METR_GLOB_CTR_CX_RX_SAR,
HSS_METR_GLOB_CTR_CX_RX_UAR,
HSS_METR_GLOB_CTR_CX_RX_LIR,
HSS_METR_GLOB_CTR_S6A_RX_UNKNOWN,
HSS_METR_GLOB_CTR_S6A_RX_AIR,
HSS_METR_GLOB_CTR_S6A_RX_CLA,
HSS_METR_GLOB_CTR_S6A_RX_IDA,
HSS_METR_GLOB_CTR_S6A_RX_PUR,
HSS_METR_GLOB_CTR_S6A_RX_ULR,
HSS_METR_GLOB_CTR_S6A_TX_CLR,
HSS_METR_GLOB_CTR_S6A_TX_IDR,
HSS_METR_GLOB_GAUGE_IMSI,
HSS_METR_GLOB_GAUGE_IMPI,
HSS_METR_GLOB_GAUGE_IMPU,