From 1677557fae3abd8084e018b1f0354f9c53ed7c7f Mon Sep 17 00:00:00 2001 From: Jimmy Berry Date: Tue, 24 Apr 2018 18:20:44 -0500 Subject: [PATCH] metrics: ingest_dashboard_config: rename seen to previous. More accurately describes the new purpose. --- metrics.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/metrics.py b/metrics.py index 7c326e67..8d81b750 100755 --- a/metrics.py +++ b/metrics.py @@ -410,29 +410,29 @@ def dashboard_at_changed(api, filename, revision=None): return None def ingest_dashboard_config(content): - if not hasattr(ingest_dashboard_config, 'seen'): + if not hasattr(ingest_dashboard_config, 'previous'): result = client.query('SELECT * FROM dashboard_config ORDER BY time DESC LIMIT 1') if result: # Extract last point and remove zero values since no need to fill. point = next(result.get_points()) point = {k: v for (k, v) in point.iteritems() if k != 'time' and v != 0} - ingest_dashboard_config.seen = set(point.keys()) + ingest_dashboard_config.previous = set(point.keys()) else: - ingest_dashboard_config.seen = set() + ingest_dashboard_config.previous = set() fields = {} for key, value in content.items(): if key.startswith('repo_checker-binary-whitelist'): - ingest_dashboard_config.seen.add(key) + ingest_dashboard_config.previous.add(key) fields[key] = len(value.split()) # Ensure any previously seen key are filled with zeros if no longer present # to allow graphs to fill with previous. fields_keys = set(fields.keys()) - missing = ingest_dashboard_config.seen - fields_keys + missing = ingest_dashboard_config.previous - fields_keys if len(missing): - ingest_dashboard_config.seen = fields_keys + ingest_dashboard_config.previous = fields_keys for key in missing: fields[key] = 0