Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong comparison func implement in translator/prometheusremotewrite #35741

Closed
stan-fu opened this issue Oct 11, 2024 · 3 comments
Closed

wrong comparison func implement in translator/prometheusremotewrite #35741

stan-fu opened this issue Oct 11, 2024 · 3 comments
Assignees
Labels

Comments

@stan-fu
Copy link

stan-fu commented Oct 11, 2024

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

@stan-fu stan-fu added bug Something isn't working needs triage New item requiring triage labels Oct 11, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@dashpole dashpole removed the needs triage New item requiring triage label Oct 11, 2024
@dashpole
Copy link
Contributor

@jmichalek132 can you fix this? Should be a quick and easy one.

andrzej-stencel pushed a commit that referenced this issue Oct 16, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue #35741
Fixes 
Wrong comparison func implement in translator/prometheusremotewrite.

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Signed-off-by: Juraj Michalek <[email protected]>
@jmichalek132
Copy link
Contributor

Can be closed as #35763 is merged fyi @dashpole.

sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this issue Dec 17, 2024
)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue open-telemetry#35741
Fixes 
Wrong comparison func implement in translator/prometheusremotewrite.

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Signed-off-by: Juraj Michalek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants