From 1c51ef8a697480edf9d2fcbf24f4fe4b5d8e404e Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 11 Apr 2023 15:06:48 -0400 Subject: [PATCH] Store serialized metrics locally (#13833) --- awx/main/analytics/subsystem_metrics.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/awx/main/analytics/subsystem_metrics.py b/awx/main/analytics/subsystem_metrics.py index d8836b332f..4e10ff98b8 100644 --- a/awx/main/analytics/subsystem_metrics.py +++ b/awx/main/analytics/subsystem_metrics.py @@ -298,11 +298,13 @@ class Metrics: try: current_time = time.time() if current_time - self.previous_send_metrics.decode(self.conn) > self.send_metrics_interval: + serialized_metrics = self.serialize_local_metrics() payload = { 'instance': self.instance_name, - 'metrics': self.serialize_local_metrics(), + 'metrics': serialized_metrics, } - + # store the serialized data locally as well, so that load_other_metrics will read it + self.conn.set(root_key + '_instance_' + self.instance_name, serialized_metrics) emit_channel_notification("metrics", payload) self.previous_send_metrics.set(current_time)