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

Question:
You are writing a custom service discovery mechanism for Prometheus called “Windows Discovery” which leverages file_sd_configs. Some of the Windows targets must be scraped via HTTP while others should be scraped via HTTPS.
How should you configure Prometheus and Windows Discovery to scrape these targets appropriately with the fewest number of scrape and relabel configs?

  1. Configure Windows Discovery to apply label __scheme__: https to targets that require scraping via HTTPS. Configure a single Prometheus scrape job with no relabels
  2. Configure Windows Discovery to apply label scheme: https to targets that require scraping via HTTPS. Configure a single Prometheus scrape job with one relabel that takes the scheme label and writes it to the __scheme__ label if it has a nonempty value
  3. Configure Windows Discovery to apply label scheme: https to targets that require scraping via HTTPS. Configure two Prometheus scrape jobs, each with a single relabel. One job should drop targets matching scheme: https and the other should keep targets matching scheme: https. The latter job should also specify scheme: https in the job configuration
  4. Configure Windows Discovery to apply label scheme: https to targets that require scraping via HTTPS. Configure a single Prometheus scrape job with no relabels
Answer:
A - is the correct answer
B - is incorrect. While this setup would work as intended, it contains one more relabel than is necessary. By configuring Windows Discovery to directly write to the __scheme__ label, the relabel can be avoided
C - is incorrect. While this setup would work as intended, it is overly complicated. Windows Discovery can be configured to write directly to the __scheme__ label. On scrapes of each target, Prometheus will inspect that label and use the appropriate scheme as specified for that target
D - is incorrect as it is the __scheme__ label has semantic meaning in Prometheus as the scheme that should be used for the scrape. A scheme label will have no effect on the scrape