0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/free_mon/libs/mock_http_common.py
2019-04-08 14:08:49 -04:00

25 lines
636 B
Python

"""Common code for mock free monitoring http endpoint."""
import json
URL_PATH_STATS = "/stats"
URL_PATH_LAST_REGISTER = "/last_register"
URL_PATH_LAST_METRICS = "/last_metrics"
URL_DISABLE_FAULTS = "/disable_faults"
URL_ENABLE_FAULTS = "/enable_faults"
class Stats:
"""Stats class shared between client and server."""
def __init__(self):
self.register_calls = 0
self.metrics_calls = 0
self.fault_calls = 0
def __repr__(self):
return json.dumps({
'metrics': self.metrics_calls,
'registers': self.register_calls,
'faults': self.fault_calls,
})