Python prometheus_client.core.CollectorRegistry() Examples
The following are 3
code examples of prometheus_client.core.CollectorRegistry().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
prometheus_client.core
, or try the search function
.
Example #1
Source File: test_exposition.py From client_python with Apache License 2.0 | 5 votes |
def setUp(self): self.registry = CollectorRegistry() # Mock time so _created values are fixed. self.old_time = time.time time.time = lambda: 123.456
Example #2
Source File: test_exposition.py From client_python with Apache License 2.0 | 5 votes |
def setUp(self): self.registry = CollectorRegistry() self.counter = Gauge('g', 'help', registry=self.registry) self.requests = requests = [] class TestHandler(BaseHTTPRequestHandler): def do_PUT(self): if 'with_basic_auth' in self.requestline and self.headers['authorization'] != 'Basic Zm9vOmJhcg==': self.send_response(401) else: self.send_response(201) length = int(self.headers['content-length']) requests.append((self, self.rfile.read(length))) self.end_headers() do_POST = do_PUT do_DELETE = do_PUT httpd = HTTPServer(('localhost', 0), TestHandler) self.address = 'http://localhost:{0}'.format(httpd.server_address[1]) class TestServer(threading.Thread): def run(self): httpd.handle_request() self.server = TestServer() self.server.daemon = True self.server.start()
Example #3
Source File: test_exposition.py From client_python with Apache License 2.0 | 5 votes |
def registry(): return core.CollectorRegistry()