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

TargetAllocator returned scrape config crashes otel MetricsReceiver when relabel or metric relabel action has action:keepequal or dropequal #2793

Closed
rashmichandrashekar opened this issue Mar 27, 2024 · 1 comment · Fixed by #2794
Labels
bug Something isn't working needs triage

Comments

@rashmichandrashekar
Copy link
Contributor

rashmichandrashekar commented Mar 27, 2024

Component(s)

target allocator

What happened?

Description

TargetAllocator's responce crashes metricsreceiver when relabel or metric relabel action has action:keepequal or dropequal.
When the metricsreceiver calls the TA service to receive config and unmarshal the response, it fails because of the unmarshal implementation. https://github.com/prometheus/prometheus/blob/25a8d576717f4a69290d6f6755b4a90cfaab08ff/model/relabel/relabel.go#L144C3-L144C46
This is related to this issue - prometheus/prometheus#12534

Steps to Reproduce

Use configmap or pod or service monitor CRD that use action keepequal or dropequal.

Expected Result

The action should not result in otel metrics receiver crashing

Actual Result

Prometheus Metrics Receiver crashes after receiving config from TA with the following error -
"level":"error","ts":1707850745.82048,"caller":"prometheusreceiver/metrics_receiver.go:167","msg":"Failed to retrieve job list","kind":"receiver","name":"prometheus","data_typ
e":"metrics","error":"keepequal action requires only 'source_labels' and target_label, and no other fields"

Kubernetes Version

1.26.12

Operator version

0.96.0

Collector version

0.96.0

Environment information

No response

Log output

No response

Additional context

No response

@swiatekm
Copy link
Contributor

I'd love to solve this in a robust way, where we can be confident we're generating valid config, not just for these specific relabel actions. I think we might be able to imitate what prometheus-operator does, maybe Prometheus itself also has a config serialization mechanism defined that we could reuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants