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

Question:
Which module of the Prometheus client library is used for parsing metric text data?

  1. prometheus_client.metrics
  2. prometheus_client.core
  3. prometheus_client.registry
  4. prometheus_client.parser
Answer:
D - correct answer. The prometheus_client.parser module of the Prometheus client library is used for parsing metric text data. This module provides a text_string_to_metric_families() function that can parse text data in the Prometheus exposition format and return a list of MetricFamily objects
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
C - is incorrect as the prometheus_client.registry module is used for creating custom collectors