mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
cfg: add conn_status_stat_queue/threshold_ids for diameter
This commit is contained in:
committed by
Dan Christian Bogos
parent
80e645e38b
commit
22211b2b96
@@ -72,7 +72,9 @@ func TestDiamConnStats(t *testing.T) {
|
||||
"diameter_agent": {
|
||||
"enabled": true,
|
||||
"stats_conns": ["*localhost"],
|
||||
// "thresholds_conns": ["*localhost"]
|
||||
// "thresholds_conns": ["*localhost"],
|
||||
"conn_status_stat_queue_ids": ["SQ_CONN_1", "SQ_CONN_2", "SQ_CONN_3"],
|
||||
// "conn_status_threshold_ids": [],
|
||||
"conn_health_check_interval": "100ms"
|
||||
}
|
||||
}`,
|
||||
|
||||
@@ -461,8 +461,11 @@ const (
|
||||
|
||||
// sendConnStatusReport reports connection status changes to StatS and ThresholdS.
|
||||
func (da *DiameterAgent) sendConnStatusReport(metadata *smpeer.Metadata, status int, localAddr, remoteAddr net.Addr) {
|
||||
statsConns := da.cgrCfg.DiameterAgentCfg().StatSConns
|
||||
thConns := da.cgrCfg.DiameterAgentCfg().ThresholdSConns
|
||||
sqIDs := da.cgrCfg.DiameterAgentCfg().ConnStatusStatQueueIDs
|
||||
thIDs := da.cgrCfg.DiameterAgentCfg().ConnStatusThresholdIDs
|
||||
if len(sqIDs) == 0 && len(thIDs) == 0 {
|
||||
return // nothing to do
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
Tenant: da.cgrCfg.GeneralCfg().DefaultTenant,
|
||||
@@ -480,18 +483,23 @@ func (da *DiameterAgent) sendConnStatusReport(metadata *smpeer.Metadata, status
|
||||
},
|
||||
}
|
||||
|
||||
if len(statsConns) != 0 {
|
||||
if len(sqIDs) != 0 {
|
||||
ev.APIOpts[utils.OptsStatsProfileIDs] = sqIDs
|
||||
var reply []string
|
||||
if err := da.connMgr.Call(context.TODO(), statsConns, utils.StatSv1ProcessEvent,
|
||||
ev, &reply); err != nil {
|
||||
if err := da.connMgr.Call(context.TODO(),
|
||||
da.cgrCfg.DiameterAgentCfg().StatSConns,
|
||||
utils.StatSv1ProcessEvent, ev, &reply); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("failed to process %s event in %s: %v",
|
||||
utils.EventConnectionStatusReport, utils.StatS, err))
|
||||
}
|
||||
delete(ev.APIOpts, utils.OptsStatsProfileIDs)
|
||||
}
|
||||
if len(thConns) != 0 {
|
||||
if len(thIDs) != 0 {
|
||||
ev.APIOpts[utils.OptsThresholdsProfileIDs] = thIDs
|
||||
var reply []string
|
||||
if err := da.connMgr.Call(context.TODO(), thConns, utils.ThresholdSv1ProcessEvent,
|
||||
ev, &reply); err != nil {
|
||||
if err := da.connMgr.Call(context.TODO(),
|
||||
da.cgrCfg.DiameterAgentCfg().ThresholdSConns,
|
||||
utils.ThresholdSv1ProcessEvent, ev, &reply); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("failed to process %s event in %s: %v",
|
||||
utils.EventConnectionStatusReport, utils.ThresholdS, err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user