Interview Prep/Monitoring & Observability/Long-Term Storage, Scale and Cost

Grafana shows every series twice after you added a second Prometheus replica with Thanos. How do you fix it?

IntermediateScenarioLong-Term Storage, Scale and Cost
Answer

Situation read → The HA pair scrapes the same targets; Thanos Querier is not deduplicating.

What I'd do →

  1. Give each replica a distinguishing external label, everything else identical:
    global:
      external_labels: { cluster: prod-eu, replica: prometheus-0 }
    
  2. Start the Querier with the replica label:
    thanos query --query.replica-label=replica --endpoint=dnssrv+_grpc._tcp.thanos-store
    
  3. Make sure Grafana's datasource does not disable deduplication (the dedup=true parameter is the default).
  4. For the compactor, set --deduplication.replica-label=replica to deduplicate stored blocks too.

Why → Deduplication merges series that differ only by the replica label and fills gaps from the other replica.

Interview tip → With the Prometheus Operator, the prometheus_replica label is added automatically; use that as the replica label.

All Monitoring & Observability questions

More on Long-Term Storage, Scale and Cost