Skip to content

wrong comparison func implement in translator/prometheusremotewrite #35741

@stan-fu

Description

@stan-fu

Component(s)

pkg/translator/prometheusremotewrite

What happened?

Description

in func isSameMetric, ts is compare with itself

func isSameMetric(ts *prompb.TimeSeries, lbls []prompb.Label) bool {
	if len(ts.Labels) != len(lbls) {
		return false
	}
	for i, l := range ts.Labels {
		if l.Name != ts.Labels[i].Name || l.Value != ts.Labels[i].Value {
			return false
		}
	}
	return true
}

revise

func isSameMetric(ts *prompb.TimeSeries, lbls []prompb.Label) bool {
	if len(ts.Labels) != len(lbls) {
		return false
	}
	for i, l := range ts.Labels {
		if l.Name != lbls[i].Name || l.Value != lbls[i].Value {
			return false
		}
	}
	return true
}

Collector version

master

Environment information

No response

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions