prometheus fix multithreading

This commit is contained in:
vela-jabber 2021-04-17 17:58:42 +02:00
parent d2d8ef2880
commit c42b0f8a51
1 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import logging import logging
from http.server import BaseHTTPRequestHandler, HTTPServer from http.server import BaseHTTPRequestHandler, HTTPServer, ThreadingHTTPServer
from socket import AF_INET6 from socket import AF_INET6
from time import time from time import time
from urllib.parse import parse_qs, urlparse from urllib.parse import parse_qs, urlparse
@ -126,7 +126,7 @@ class Prometheus:
def listen(self, addr=("127.0.0.1", 8080)): def listen(self, addr=("127.0.0.1", 8080)):
if "::" in addr[0]: if "::" in addr[0]:
HTTPServer.address_family = AF_INET6 HTTPServer.address_family = AF_INET6
server = HTTPServer(addr, DynamicMetricsHandler.factory(self.handler)) server = ThreadingHTTPServer(addr, DynamicMetricsHandler.factory(self.handler))
server.serve_forever() server.serve_forever()