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

Question:
Which module of the Prometheus client library is used for creating custom collectors?

  1. prometheus_client.metrics
  2. prometheus_client.core
  3. prometheus_client.registry
  4. prometheus_client.parser
Answer:
C - is correct. The prometheus_client.registry module of the Prometheus client library is used for creating custom collectors. The CollectorRegistry class provided by this module allows you to register and manage your own metrics
A - is incorrect as the prometheus_client.metrics module contains pre-defined metric types
B - is incorrect as the prometheus_client.core module contains low-level classes and functions used by the other modules
D - is incorrect as the prometheus_client.parser module is used for parsing metric text data