mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
prometheus_agent: add cores_conns config opt
This commit is contained in:
committed by
Dan Christian Bogos
parent
13044ddd9d
commit
e117b2df30
@@ -1024,6 +1024,7 @@ const CGRATES_CFG_JSON = `
|
||||
"path": "/prometheus", // endpoint for prometheus metrics
|
||||
"collect_go_metrics": false, // include Go runtime metrics (memory, GC, goroutines)
|
||||
"collect_process_metrics": false, // include process metrics (CPU, file descriptors)
|
||||
// "cores_conns": [], // connections to CoreS, empty to disable: <""|*internal|$rpc_conns_id>
|
||||
// "stats_conns": [], // connections to StatS, empty to disable: <""|*internal|$rpc_conns_id>
|
||||
// "stat_queue_ids": [] // StatQueue IDs to collect metrics from <[tenant]:ID>
|
||||
},
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -31,6 +31,7 @@ type PrometheusAgentJsonCfg struct {
|
||||
Path *string `json:"path"`
|
||||
CollectGoMetrics *bool `json:"collect_go_metrics"`
|
||||
CollectProcessMetrics *bool `json:"collect_process_metrics"`
|
||||
CoreSConns *[]string `json:"cores_conns"`
|
||||
StatSConns *[]string `json:"stats_conns"`
|
||||
StatQueueIDs *[]string `json:"stat_queue_ids"`
|
||||
}
|
||||
@@ -41,6 +42,7 @@ type PrometheusAgentCfg struct {
|
||||
Path string
|
||||
CollectGoMetrics bool
|
||||
CollectProcessMetrics bool
|
||||
CoreSConns []string
|
||||
StatSConns []string
|
||||
StatQueueIDs []string
|
||||
}
|
||||
@@ -70,6 +72,9 @@ func (c *PrometheusAgentCfg) loadFromJSONCfg(jc *PrometheusAgentJsonCfg) error {
|
||||
if jc.CollectProcessMetrics != nil {
|
||||
c.CollectProcessMetrics = *jc.CollectProcessMetrics
|
||||
}
|
||||
if jc.CoreSConns != nil {
|
||||
c.CoreSConns = updateBiRPCInternalConns(*jc.CoreSConns, utils.MetaStats)
|
||||
}
|
||||
if jc.StatSConns != nil {
|
||||
c.StatSConns = updateBiRPCInternalConns(*jc.StatSConns, utils.MetaStats)
|
||||
}
|
||||
@@ -86,6 +91,7 @@ func (c PrometheusAgentCfg) AsMapInterface() any {
|
||||
utils.PathCfg: c.Path,
|
||||
utils.CollectGoMetricsCfg: c.CollectGoMetrics,
|
||||
utils.CollectProcessMetricsCfg: c.CollectProcessMetrics,
|
||||
utils.CoreSConnsCfg: getBiRPCInternalJSONConns(c.CoreSConns),
|
||||
utils.StatSConnsCfg: getBiRPCInternalJSONConns(c.StatSConns),
|
||||
utils.StatQueueIDsCfg: c.StatQueueIDs,
|
||||
}
|
||||
@@ -101,6 +107,7 @@ func (c PrometheusAgentCfg) Clone() *PrometheusAgentCfg {
|
||||
Path: c.Path,
|
||||
CollectGoMetrics: c.CollectGoMetrics,
|
||||
CollectProcessMetrics: c.CollectProcessMetrics,
|
||||
CoreSConns: slices.Clone(c.CoreSConns),
|
||||
StatSConns: slices.Clone(c.StatSConns),
|
||||
StatQueueIDs: slices.Clone(c.StatQueueIDs),
|
||||
}
|
||||
@@ -123,7 +130,11 @@ func diffPrometheusAgentJsonCfg(d *PrometheusAgentJsonCfg, v1, v2 *PrometheusAge
|
||||
if v1.CollectProcessMetrics != v2.CollectProcessMetrics && true {
|
||||
d.CollectProcessMetrics = utils.BoolPointer(v2.CollectProcessMetrics)
|
||||
}
|
||||
if !slices.Equal(v1.CoreSConns, v2.CoreSConns) {
|
||||
d.CoreSConns = utils.SliceStringPointer(v2.CoreSConns)
|
||||
}
|
||||
if !slices.Equal(v1.StatSConns, v2.StatSConns) {
|
||||
d.StatSConns = utils.SliceStringPointer(v2.StatSConns)
|
||||
}
|
||||
if !slices.Equal(v1.StatQueueIDs, v2.StatQueueIDs) {
|
||||
d.StatQueueIDs = utils.SliceStringPointer(v2.StatQueueIDs)
|
||||
|
||||
@@ -2111,6 +2111,7 @@ const (
|
||||
RequestProcessorsCfg = "request_processors"
|
||||
|
||||
// PrometheusAgentCfg
|
||||
CoreSConnsCfg = "cores_conns"
|
||||
CollectGoMetricsCfg = "collect_go_metrics"
|
||||
CollectProcessMetricsCfg = "collect_process_metrics"
|
||||
StatQueueIDsCfg = "stat_queue_ids"
|
||||
|
||||
Reference in New Issue
Block a user