From c1ca7baa1b41c8df13c96398f6807169e88b8b50 Mon Sep 17 00:00:00 2001 From: Ryan Kemper Date: Mon, 31 Aug 2020 08:42:57 -0700 Subject: [PATCH] elasticsearch: fix prom query syntax Error was spicerack.prometheus.PrometheusError: Unable to get metric: HTTP 400: {"status":"error","errorType":"bad_data","error":"parse error at char 28: unexpected left brace '{'"} Fix was to switch query from using {{ to using { Change-Id: I9de09dc4f8bdc10d334e0df20ea45711d2c5510d --- spicerack/elasticsearch_cluster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spicerack/elasticsearch_cluster.py b/spicerack/elasticsearch_cluster.py index 02f3960..f11e3e4 100644 --- a/spicerack/elasticsearch_cluster.py +++ b/spicerack/elasticsearch_cluster.py @@ -329,10 +329,10 @@ def wait_for_all_write_queues_empty(self) -> None: # We expect all DCs except one to return empty results, but we have a problem if all return empty have_received_results = False for dc in self._core_datacenters: - query = ('kafka_burrow_partition_lag{{' + query = ('kafka_burrow_partition_lag{' ' group="cpjobqueue-cirrusSearchElasticaWrite",' ' topic=~"[[:alpha:]]*.cpjobqueue.partitioned.mediawiki.job.cirrusSearchElasticaWrite"' - '}}') + '}') # Query returns a list of dictionaries each of format {'metric': {}, 'value': [$timestamp, $value]} results = self._prometheus.query(query, dc) if not results: