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

Question:
What configuration will make it so Prometheus doesn’t scrape targets with a label of team: frontend?

  1. relabel_configs:
      - source_labels: [team]
        regex: frontend
        action: drop
  2. relabel_configs:
      - source_labels: [frontend]
        regex: team
        action: drop
  3. metric_relabel_configs:
      - source_labels: [team]
        regex: frontend
        action: drop
  4. relabel_configs:
      - match: [team]
        regex: frontend
        action: drop
Answer:
A - is the correct answer. The relabel_configs is where you will define which targets Prometheus should scrape. To match on label team: frontend. Set the source_labels to team, regex field should represent the value of the label frontend, since we don’t want to scrape the targets, specify action: drop