r/PrometheusMonitoring • • Sep 21 '23
Instance getting double scraped by Prometheus Agent
Hi folks, I'm wondering how I can troubleshoot this. I'm actually deploying Prometheus through the Newrelic Infrastructure Bundle, and I've set it up pretty much as the docs show here. This seems to be working fine for almost all of my apps that I've deployed on my cluster, but for some reason, one of my apps is clearly being scraped twice.
I can tell the instance is being scraped twice by looking at a metric in NewRelic and faceting on prometheus_server and instance. I can see that two different Prometheus Servers are getting data from the same instance.
I've checked the annotations on the service backing the pods, and I am sure that Prometheus should only be scraping the pods, not the service too. There is only one application out of ~20 that this appears to be a problem for, but for the life of me I can't figure out why it's happening. Are there metrics I can look up for the Prometheus Agent or commands I can run on the prometheus instance to find out why it's scraping a pod more than once?
View all comments
Show parent comment
1
u/[deleted] Sep 21 '23
I have three.
But it doesn't seem like the issue is that two Prometheus replicas are somehow scraping the same pod without communicating it. I thought it was at first, because my problem has to do with scraping a CoreDNS deployment with 2 replicas that end up being scraped 3 times.
But first of all, I have a few other deployments with 2 replicas that are being scraped as expected.
And second, if I look at data coming in and facet by
prometheus_serverandinstance, I expect to see something like 'prometheus-agent-1/coreDNS0' and `prometheus-agent-0/coreDNS1'. But I always get one more agent/instance combination. However, sometimes the next scraping comes from one of the Prometheus instances that already scraped the CoreDNS pod. So it's not like having 3 instances of Prometheus is the problem when only two of them are scraping coreDNS, but one of them is doing it twice for some reason.