task 3 where you " Update the /root/main.py
file to replace the Question 3: PLACEHOLDER
section with a Counter
metric called http_requests_total
"
I followed the steps confirmed via hints/solutions but the task still says failed/incomplete.
here the update done in the task
from prometheus_client
from flask import Flask
from prometheus_client import Counter
REQUESTS = Counter(‘http_requests_total’,
‘Total number of requests’)
task link:
https://learn.kodekloud.com/user/courses/prometheus-certified-associate-pca/module/0c0155c7-00c8-4ca2-a061-e66baa1a3216/lesson/9822084e-5e32-4e25-89ef-335fce5cc0f8
This is a bit of a curveball.
Note the very first line of the file
from prometheus_client
This as it stands is a syntax error. With from
you must import
something.
Therefore you need to edit that line to import Counter
rather than put the whole line - thus we are importing Counter from the prometheus_client library.
from prometheus_client import Counter
from flask import Flask
REQUESTS = Counter('http_requests_total',
'Total number of requests')
"""
Question 10: PLACEHOLDER-1
"""
If in future questions anything else needs to be imported from the client library, eg Gauge
, those too will go on this line, e.g.
from prometheus_client import Counter, Gauge
thank you, I’m going to try