Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch KeyError exception in prometheus #652

Closed
gbregman opened this issue May 17, 2024 · 0 comments · Fixed by #653
Closed

Catch KeyError exception in prometheus #652

gbregman opened this issue May 17, 2024 · 0 comments · Fixed by #653
Assignees

Comments

@gbregman
Copy link
Contributor

We ran into a case in which a failure in SPDK caused a KeyError exception in the prometheus code which crashed the gateway. I suggest making this change to protect the gateway:

diff --git a/control/prometheus.py b/control/prometheus.py
index 4d3886b..65d2392 100644
--- a/control/prometheus.py
+++ b/control/prometheus.py
@@ -391,7 +391,10 @@ class NVMeOFCollector:
                     str(ns.anagrpid)
                 ], 1)

-            conn_info = self.connections[nqn]
+            try:
+                conn_info = self.connections[nqn]
+            except KeyError:
+                continue
             for conn in conn_info.connections:
                 host_connection_state.add_metric([
                     self.gw_metadata.name,
@gbregman gbregman self-assigned this May 17, 2024
gbregman added a commit to gbregman/ceph-nvmeof that referenced this issue May 19, 2024
Fixes ceph#652

Signed-off-by: Gil Bregman <gbregman@il.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant