PCA (Prometheus Certified Associate) sample exam question with answer 329

Question:
What happens to metrics for an instance when it is renamed or removed and the Pushgateway is being used for metrics collection?

  1. The metrics will automatically disappear along with the instance
  2. The metrics will remain in the Pushgateway forever unless manually deleted
  3. The metrics will be cached by the Pushgateway until the instance is readded
  4. The metrics will be automatically synchronized with the lifecycle of the Pushgateway
Answer:
B - correct answer. When multiple instances of a job differentiate their metrics in the Pushgateway via an instance label or similar, metrics for an instance will remain in the Pushgateway even if the originating instance is renamed or removed. This is because the lifecycle of the Pushgateway as a metrics cache is fundamentally separate from the lifecycle of the processes that push metrics to it. Therefore, any stale metrics would need to be deleted manually or the lifecycle synchronization would need to be automated