Can you give an specific example of "same metrics are published on two different endpoints" ?
You might mean:
- two different metric names
- the same metric name, but different labels
And it might be that you're scraping the same target twice, or you're scraping one target but that target is (for some reason) returning duplicates in the scrape results. Or you might have a more complex scenario, e.g. multiple prometheus servers scraping for redundancy, and then you're combining the results together somehow.
> Is it possible to pick one endpoint and discard the other while writing a PromQL query ?
Sure. Just filter in the PromQL query. For example, if you have
foo{aaa="bbb",ccc="ddd"} 123.0
foo{aaa="bbb",ccc="fff"} 123.0
and you consider the one with ccc="fff" to be a "duplicate" metric, then
foo{ccc!="fff"}
might be what you want.
Otherwise, you can avoid ingesting the duplicate metrics:
- by not scraping the second set in the first place
- if they all come from the same scrape, then using metric_relabel_configs to drop the metrics that you don't want to keep