Fix merge issues

This commit is contained in:
Thomas Roehl 2022-02-02 15:58:19 +01:00
parent 2611b1e301
commit 445cfe9159
2 changed files with 11 additions and 13 deletions

View File

@ -365,7 +365,6 @@ func (m *LikwidCollector) Init(config json.RawMessage) error {
return nil
}
// take a measurement for 'interval' seconds of event set index 'group'
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
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
evset := m.config.Eventsets[group]
gid := m.groups[group]
@ -446,7 +445,7 @@ func (m *LikwidCollector) calcEventsetMetrics(group int, interval time.Duration,
fields := map[string]interface{}{"value": value}
y, err := lp.New(metric.Name, tags, m.meta, fields, time.Now())
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
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 {
scopemap := m.scopeRespTids[metric.Scope]
for domain, tid := range scopemap {
@ -483,7 +482,7 @@ func (m *LikwidCollector) calcGlobalMetrics(interval time.Duration, output chan
fields := map[string]interface{}{"value": value}
y, err := lp.New(metric.Name, tags, m.meta, fields, time.Now())
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
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 {
return
}
for i, _ := range m.groups {
for i := range m.groups {
// measure event set 'i' for 'interval' seconds
err := m.takeMeasurement(i, interval)
if err != nil {

View File

@ -135,7 +135,6 @@ func (r *metricRouter) StartTimer() {
cclog.ComponentDebug("MetricRouter", "TIMER START")
}
func getParamMap(point lp.CCMetric) map[string]interface{} {
params := make(map[string]interface{})
params["metric"] = point
@ -162,7 +161,7 @@ func (r *metricRouter) DoAddTags(point *lp.CCMetric) {
conditionMatches = true
} else {
var err error
conditionMatches, err = EvalBoolCondition(m.Condition, getParamMap(point))
conditionMatches, err = EvalBoolCondition(m.Condition, getParamMap(*point))
if err != nil {
cclog.ComponentError("MetricRouter", err.Error())
conditionMatches = false
@ -183,7 +182,7 @@ func (r *metricRouter) DoDelTags(point *lp.CCMetric) {
conditionMatches = true
} else {
var err error
conditionMatches, err = EvalBoolCondition(m.Condition, getParamMap(point))
conditionMatches, err = EvalBoolCondition(m.Condition, getParamMap(*point))
if err != nil {
cclog.ComponentError("MetricRouter", err.Error())
conditionMatches = false
@ -198,7 +197,7 @@ func (r *metricRouter) DoDelTags(point *lp.CCMetric) {
// Conditional test whether a metric should be dropped
func (r *metricRouter) dropMetric(point *lp.CCMetric) bool {
// Simple drop check
if _, ok := r.config.dropMetrics[(*point).Name()]; ok {
if _, ok := r.config.dropMetrics[(*point).Name()]; ok {
return true
}
// Checking the dropping conditions
@ -231,8 +230,8 @@ func (r *metricRouter) Start() {
cclog.ComponentDebug("MetricRouter", "FORWARD", *point)
r.DoAddTags(point)
r.DoDelTags(point)
if new, ok := r.config.RenameMetrics[point.Name()]; ok {
point.SetName(new)
if new, ok := r.config.RenameMetrics[(*point).Name()]; ok {
(*point).SetName(new)
}
r.DoAddTags(point)
r.DoDelTags(point)