mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-04-19 19:21:41 +02:00
Fix merge issues
This commit is contained in:
parent
2611b1e301
commit
445cfe9159
@ -365,7 +365,6 @@ func (m *LikwidCollector) Init(config json.RawMessage) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// take a measurement for 'interval' seconds of event set index 'group'
|
// take a measurement for 'interval' seconds of event set index 'group'
|
||||||
func (m *LikwidCollector) takeMeasurement(group int, interval time.Duration) error {
|
func (m *LikwidCollector) takeMeasurement(group int, interval time.Duration) error {
|
||||||
|
|
||||||
@ -399,7 +398,7 @@ func (m *LikwidCollector) takeMeasurement(group int, interval time.Duration) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get all measurement results for an event set, derive the metric values out of the measurement results and send it
|
// Get all measurement results for an event set, derive the metric values out of the measurement results and send it
|
||||||
func (m *LikwidCollector) calcEventsetMetrics(group int, interval time.Duration, output chan lp.CCMetric) error {
|
func (m *LikwidCollector) calcEventsetMetrics(group int, interval time.Duration, output chan *lp.CCMetric) error {
|
||||||
var eidx C.int
|
var eidx C.int
|
||||||
evset := m.config.Eventsets[group]
|
evset := m.config.Eventsets[group]
|
||||||
gid := m.groups[group]
|
gid := m.groups[group]
|
||||||
@ -446,7 +445,7 @@ func (m *LikwidCollector) calcEventsetMetrics(group int, interval time.Duration,
|
|||||||
fields := map[string]interface{}{"value": value}
|
fields := map[string]interface{}{"value": value}
|
||||||
y, err := lp.New(metric.Name, tags, m.meta, fields, time.Now())
|
y, err := lp.New(metric.Name, tags, m.meta, fields, time.Now())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
output <- y
|
output <- &y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,7 +455,7 @@ func (m *LikwidCollector) calcEventsetMetrics(group int, interval time.Duration,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Go over the global metrics, derive the value out of the event sets' metric values and send it
|
// Go over the global metrics, derive the value out of the event sets' metric values and send it
|
||||||
func (m *LikwidCollector) calcGlobalMetrics(interval time.Duration, output chan lp.CCMetric) error {
|
func (m *LikwidCollector) calcGlobalMetrics(interval time.Duration, output chan *lp.CCMetric) error {
|
||||||
for _, metric := range m.config.Metrics {
|
for _, metric := range m.config.Metrics {
|
||||||
scopemap := m.scopeRespTids[metric.Scope]
|
scopemap := m.scopeRespTids[metric.Scope]
|
||||||
for domain, tid := range scopemap {
|
for domain, tid := range scopemap {
|
||||||
@ -483,7 +482,7 @@ func (m *LikwidCollector) calcGlobalMetrics(interval time.Duration, output chan
|
|||||||
fields := map[string]interface{}{"value": value}
|
fields := map[string]interface{}{"value": value}
|
||||||
y, err := lp.New(metric.Name, tags, m.meta, fields, time.Now())
|
y, err := lp.New(metric.Name, tags, m.meta, fields, time.Now())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
output <- y
|
output <- &y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -492,12 +491,12 @@ func (m *LikwidCollector) calcGlobalMetrics(interval time.Duration, output chan
|
|||||||
}
|
}
|
||||||
|
|
||||||
// main read function taking multiple measurement rounds, each 'interval' seconds long
|
// main read function taking multiple measurement rounds, each 'interval' seconds long
|
||||||
func (m *LikwidCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
func (m *LikwidCollector) Read(interval time.Duration, output chan *lp.CCMetric) {
|
||||||
if !m.init {
|
if !m.init {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, _ := range m.groups {
|
for i := range m.groups {
|
||||||
// measure event set 'i' for 'interval' seconds
|
// measure event set 'i' for 'interval' seconds
|
||||||
err := m.takeMeasurement(i, interval)
|
err := m.takeMeasurement(i, interval)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -135,7 +135,6 @@ func (r *metricRouter) StartTimer() {
|
|||||||
cclog.ComponentDebug("MetricRouter", "TIMER START")
|
cclog.ComponentDebug("MetricRouter", "TIMER START")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func getParamMap(point lp.CCMetric) map[string]interface{} {
|
func getParamMap(point lp.CCMetric) map[string]interface{} {
|
||||||
params := make(map[string]interface{})
|
params := make(map[string]interface{})
|
||||||
params["metric"] = point
|
params["metric"] = point
|
||||||
@ -162,7 +161,7 @@ func (r *metricRouter) DoAddTags(point *lp.CCMetric) {
|
|||||||
conditionMatches = true
|
conditionMatches = true
|
||||||
} else {
|
} else {
|
||||||
var err error
|
var err error
|
||||||
conditionMatches, err = EvalBoolCondition(m.Condition, getParamMap(point))
|
conditionMatches, err = EvalBoolCondition(m.Condition, getParamMap(*point))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cclog.ComponentError("MetricRouter", err.Error())
|
cclog.ComponentError("MetricRouter", err.Error())
|
||||||
conditionMatches = false
|
conditionMatches = false
|
||||||
@ -183,7 +182,7 @@ func (r *metricRouter) DoDelTags(point *lp.CCMetric) {
|
|||||||
conditionMatches = true
|
conditionMatches = true
|
||||||
} else {
|
} else {
|
||||||
var err error
|
var err error
|
||||||
conditionMatches, err = EvalBoolCondition(m.Condition, getParamMap(point))
|
conditionMatches, err = EvalBoolCondition(m.Condition, getParamMap(*point))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cclog.ComponentError("MetricRouter", err.Error())
|
cclog.ComponentError("MetricRouter", err.Error())
|
||||||
conditionMatches = false
|
conditionMatches = false
|
||||||
@ -231,8 +230,8 @@ func (r *metricRouter) Start() {
|
|||||||
cclog.ComponentDebug("MetricRouter", "FORWARD", *point)
|
cclog.ComponentDebug("MetricRouter", "FORWARD", *point)
|
||||||
r.DoAddTags(point)
|
r.DoAddTags(point)
|
||||||
r.DoDelTags(point)
|
r.DoDelTags(point)
|
||||||
if new, ok := r.config.RenameMetrics[point.Name()]; ok {
|
if new, ok := r.config.RenameMetrics[(*point).Name()]; ok {
|
||||||
point.SetName(new)
|
(*point).SetName(new)
|
||||||
}
|
}
|
||||||
r.DoAddTags(point)
|
r.DoAddTags(point)
|
||||||
r.DoDelTags(point)
|
r.DoDelTags(point)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user