From 40bd1cba4cf7f48a675d3cd98f02da6682254aa3 Mon Sep 17 00:00:00 2001 From: ngosang Date: Thu, 3 Aug 2023 06:36:31 +0200 Subject: [PATCH] Fix Prometheus exporter for management and health endpoints --- src/bottle_plugins/prometheus_plugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bottle_plugins/prometheus_plugin.py b/src/bottle_plugins/prometheus_plugin.py index 046bd5f..c1463dc 100644 --- a/src/bottle_plugins/prometheus_plugin.py +++ b/src/bottle_plugins/prometheus_plugin.py @@ -33,6 +33,10 @@ def prometheus_plugin(callback): def export_metrics(actual_response): res = V1ResponseBase(actual_response) + if res.startTimestamp is None or res.endTimestamp is None: + # skip management and healthcheck endpoints + return + domain = "unknown" if res.solution and res.solution.url: parsed_url = urllib.parse.urlparse(res.solution.url)