From 862d81c7f564b663f23ff1db48edc0746e4c1349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Mon, 31 May 2021 14:44:21 +0200 Subject: [PATCH] 2.16.6 --- satella/__init__.py | 2 +- .../metrics/exporters/prometheus.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/satella/__init__.py b/satella/__init__.py index 8507c60e..bcb43314 100644 --- a/satella/__init__.py +++ b/satella/__init__.py @@ -1 +1 @@ -__version__ = '2.16.7a1' +__version__ = '2.16.6' diff --git a/satella/instrumentation/metrics/exporters/prometheus.py b/satella/instrumentation/metrics/exporters/prometheus.py index 8b16c99e..41d28c93 100644 --- a/satella/instrumentation/metrics/exporters/prometheus.py +++ b/satella/instrumentation/metrics/exporters/prometheus.py @@ -49,8 +49,18 @@ class PrometheusHTTPExporterThread(TerminableThread): super().__init__(daemon=True) self.interface = interface # type: str self.port = port # type: int - self.httpd = http.server.HTTPServer((self.interface, self.port), PrometheusHandler, - bind_and_activate=False) + + self_2 = self + + class HTTPServer(http.server.HTTPServer): + def __init__(self): + super().__init__((self.interface, self.port), PrometheusHandler, + bind_and_activate=False) + + def get_metric_data(self): + return self_2.get_metric_data() + + self.httpd = HTTPServer() self.httpd.extra_labels = extra_labels or {} self.httpd.metric = getMetric('prometheus.exports_per_time', 'cps' if enable_metric else 'empty', -- GitLab