]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: fix prometheus federation selector to avoid unencoded '!'
authorDavid Galloway <david.galloway@ibm.com>
Fri, 27 Mar 2026 15:32:08 +0000 (11:32 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Fri, 27 Mar 2026 16:03:51 +0000 (12:03 -0400)
The Python requests library leaves '!' unencoded in URLs, causing
prometheus to return a parse error instead of metrics when using the
!= operator in the federation match selector. Use =~ instead.

Signed-off-by: David Galloway <david.galloway@ibm.com>
src/pybind/mgr/rook/ci/tests/features/steps/implementation.py

index 59cb117c8b1e077850134bbe076a250e24ad9d1e..5a5b3a77174a83d31c9f4a3cf416cd90d2e353a2 100644 (file)
@@ -53,7 +53,7 @@ def step_get_prometheus_server_ip(context):
 @given('the prometheus server is serving metrics')
 def step_given_server_running(context):
     try:
-        params = {'match[]': '{__name__!=""}'}
+        params = {'match[]': '{__name__=~".+"}'}
         response = requests.get(f"{PROMETHEUS_SERVER_URL}/federate", params)
         # Check if the response status code is successful (2xx)
         response.raise_for_status()
@@ -66,7 +66,7 @@ def step_given_server_running(context):
 
 @when('I query the Prometheus metrics endpoint')
 def step_when_query_metrics_endpoint(context):
-    params = {'match[]': '{__name__!=""}'}
+    params = {'match[]': '{__name__=~".+"}'}
     context.response = requests.get(f"{PROMETHEUS_SERVER_URL}/federate", params)
     context.response.raise_for_status()