[Metrics] Frontend-exporter fault tolerance quick fix#429
[Metrics] Frontend-exporter fault tolerance quick fix#429dcrankshaw merged 19 commits intoucbrise:developfrom
Conversation
|
Test PASSed. |
dcrankshaw
left a comment
There was a problem hiding this comment.
This looks good. Just change the print statements to logging.
monitoring/front_end_exporter.py
Outdated
|
|
||
| ADDRESS = 'http://{}/metrics'.format(query_frontend_id) | ||
|
|
||
| print("Scraping {}".format(ADDRESS)) |
There was a problem hiding this comment.
Use Python logging instead of a print statement
monitoring/front_end_exporter.py
Outdated
| res = requests.get(ADDRESS) | ||
| return res.json() | ||
| except Exception as e: | ||
| print("Scrape Failed! Error: {}\n".format(e)) |
monitoring/front_end_exporter.py
Outdated
|
|
||
|
|
||
| def parse_metric(metrics): | ||
| if not len(metrics): |
There was a problem hiding this comment.
Just for the sake of being explicit, can you change this to if len(metrics) == 0:
|
Test FAILed. |
|
Test FAILed. |
| @@ -16,14 +17,21 @@ | |||
| help='The name of docker container in clipper_network') | |||
| args = parser.parse_args() | |||
|
|
|||
There was a problem hiding this comment.
Add these lines right here:
logging.basicConfig(
format='%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',
datefmt='%y-%m-%d:%H:%M:%S',
level=logging.INFO)|
Test FAILed. |
|
Test PASSed. |
It turns out we do need a small PR to update frontend-exporter package. #427 won't pass the test with current build.
I prefer a PR instead of passing the frontend-exporter image as parameter inside the code because this complexity should be hidden to the user as best as we can.