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 hash computation returning false negative #1926

Closed
rashmichandrashekar opened this issue Jul 14, 2023 · 5 comments
Closed

TargetAllocator hash computation returning false negative #1926

rashmichandrashekar opened this issue Jul 14, 2023 · 5 comments

Comments

@rashmichandrashekar
Copy link
Contributor

rashmichandrashekar commented Jul 14, 2023

I am seeing hash computation issue for regex field where it returns a false negative, when there is only change in the regex field here -

hash, err := hashstructure.Hash(jobToScrapeConfig, nil)

For example, when there are 2 scrape configs with just the regex field changed between the 2, the hash returned is the same.

scrape_configs:
  - job_name: kube-proxy
    scrape_interval: 30s
    label_limit: 63
    label_name_length_limit: 511
    label_value_length_limit: 1023
    kubernetes_sd_configs:
    - role: pod
    relabel_configs:
    - action: keep
      source_labels:
      - __meta_kubernetes_namespace
      - __meta_kubernetes_pod_name
      separator: "/"
      regex: kube-system/kube-proxy.+
    - source_labels:
      - __address__
      action: replace
      target_label: __address__
      regex: "regex1"
      replacement: "$$1:10249"

scrape_configs:
  - job_name: kube-proxy
    scrape_interval: 30s
    label_limit: 63
    label_name_length_limit: 511
    label_value_length_limit: 1023
    kubernetes_sd_configs:
    - role: pod
    relabel_configs:
    - action: keep
      source_labels:
      - __meta_kubernetes_namespace
      - __meta_kubernetes_pod_name
      separator: "/"
      regex: kube-system/kube-proxy.+
    - source_labels:
      - __address__
      action: replace
      target_label: __address__
      regex: "regex2"
      replacement: "$$1:10249"

These 2 configs return the same hash

@rashmichandrashekar
Copy link
Contributor Author

Similar to issue - #1358

@swiatekm
Copy link
Contributor

swiatekm commented Oct 2, 2023

Fixed by #2171

@swiatekm swiatekm closed this as completed Oct 2, 2023
@rashmichandrashekar
Copy link
Contributor Author

@swiatekm-sumo - Sorry for the delay in responding to this issue as there seems to be a fix made with this - #2171
But, the fix is only partial because, if the same fix isn't made to the otel collector's prometheusreceiver, even though the hash computation here fixes the relabeling for targets, the collector fails to get the updated config and will not work e2e as expected for metric relabeling. The same fix needs to be made here
Are there any plans to make this change in the otel collector repo?

@swiatekm
Copy link
Contributor

@rashmichandrashekar you should open an issue in the contrib repo and reference this one. Looks like a simple enough fix in the receiver - thanks for pointing this out!

@rashmichandrashekar
Copy link
Contributor Author

@rashmichandrashekar you should open an issue in the contrib repo and reference this one. Looks like a simple enough fix in the receiver - thanks for pointing this out!

Thanks @swiatekm-sumo - I have created an issue here - open-telemetry/opentelemetry-collector-contrib#29313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants