summaryrefslogtreecommitdiff
path: root/jstests/free_mon/libs/mock_http_common.py
blob: 7840894062c4f6b15afca2e1746804fceb98faaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""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"

class Stats:
    """Stats class shared between client and server."""

    def __init__(self):
        self.register_calls = 0
        self.metrics_calls = 0

    def __repr__(self):
        return json.dumps({
            'metrics': self.metrics_calls,
            'registers': self.register_calls,
        })