Complete the code to import the Prometheus client library in Python.
from prometheus_client import [1]
The Counter class is commonly imported to create a metric that counts events.
Complete the code to start the Prometheus metrics HTTP server on port 8000.
start_http_server([1])Port 8000 is commonly used in examples to expose Prometheus metrics.
Fix the error in the code to increment the counter metric named 'requests_total'.
requests_total = Counter('requests_total', 'Total number of requests') requests_total[1]()
The correct method to increase a Prometheus Counter by 1 is inc().
Fill both blanks to create a Gauge metric and set its value to 5.
g = [1]('temperature_celsius', 'Current temperature in Celsius') g.[2](5)
inc() instead of set() to assign a value.A Gauge metric can be set to any value using the set() method.
Fill all three blanks to create a dictionary comprehension that collects metrics only for services with more than 10 requests.
metrics = [1]: [2] for [1], [2] in service_requests.items() if [2] > 10
The dictionary comprehension iterates over service_requests.items() with variables service and count. It collects entries where count is greater than 10.