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

Duplicate series error even when LHS has no data. #527

Closed
xujiaxj opened this issue Dec 16, 2022 · 2 comments · Fixed by #544
Closed

Duplicate series error even when LHS has no data. #527

xujiaxj opened this issue Dec 16, 2022 · 2 comments · Fixed by #544

Comments

@xujiaxj
Copy link

xujiaxj commented Dec 16, 2022

When we have a on(sth) operator query, and the right side has duplicate series, promxy returns the "found duplicate series..." message even when the left side has on data. The correct behavior, as I expect, should instead be returning empty data, like Prometheus does.

This is super easy to reproduce. Setup a Prometheus in a way we have two jobs scraping the same endpoint, for example

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'prometheus-another'
    static_configs:
      - targets: ['localhost:9090']

This will produce two up series with the same instance label but different job label:

up{instance="localhost:9090", job="prometheus"} 1
up{instance="localhost:9090", job="prometheus-another"} 1

If you run this query a * on(instance) up in Prometheus, it returns empty result as a does not exist.
image

Now start a local promxy pointing to the local Prometheus, and run the same query through promxy (I am running Grafana UI). See that you now have "found duplicate series..." error.

image

The same error happens if you run a * on() up.

If you just run a * up, it does not error out, but returns empty data.

@xujiaxj
Copy link
Author

xujiaxj commented Dec 16, 2022

This looks like a bug to me.

@xujiaxj
Copy link
Author

xujiaxj commented Jan 11, 2023

This probably can be fixed if we sync to the latest Prometheus code. This PR https://github.com/prometheus/prometheus/pull/9362/files would have fixed it. See the short-circuit change in engine.go, if either of the left or right is empty, it will just return nil instead of error out.

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

Successfully merging a pull request may close this issue.

1 participant