From 192836feffa557a6614063f9ce00f9d6ceff4a05 Mon Sep 17 00:00:00 2001 From: Sachin Agarwal Date: Thu, 17 Oct 2024 20:42:02 +0000 Subject: [PATCH] Disable scraping for containers where model_manager is not defined --- inference/core/managers/prometheus.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inference/core/managers/prometheus.py b/inference/core/managers/prometheus.py index fe2da65c7..a6ced37b0 100644 --- a/inference/core/managers/prometheus.py +++ b/inference/core/managers/prometheus.py @@ -37,6 +37,11 @@ def get_metrics(self, maxModels: int = 25): start = now - self.time_window count = 0 results = {} + if self.model_manager is None: + logger.warning( + "This inference server type does not support custom Prometheus metrics, skipping." + ) + return results for model_id in self.model_manager.models(): if count >= maxModels: break