PCA (Prometheus Certified Associate) sample exam question with answer 580
Question:
Let a Node Exporter scrape job be denoted by the label job="node". Let there be two static instances for this job, instance="node1" and instance="node2".
Which of the following queries yields all of the metrics associated with the latest scrape of node1?
- {job="node", instance="node1"}
- {job="node"}
- __metrics__{job="node", instance="node1"}
- up{job="node", instance="node1"}
Answer:
A - is the correct answer. By specifying a set of labels with no metric name, all metrics that match those labels will be returned. More at
instant-vector-selectors
B - is incorrect as this query will result in all of the metrics associated with the node job, not just for instance node1
C - is incorrect as there is no such metric __metrics__ that provides the metrics associated with a set of labels. The desired result can be achieved simply by omitting the metric name
D - is incorrect as this query will only return the value associated with the up metric