Skip to content

Commit 3d08a3a

Browse files
authored
fix metric id issue when init multiple Orchestrator instance (opea-project#1280)
Signed-off-by: Spycsh <sihan.chen@intel.com>
1 parent 7209d58 commit 3d08a3a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

comps/cores/mega/orchestrator.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@
2828

2929

3030
class OrchestratorMetrics:
31-
# Need an instance ID for metric prefix because:
32-
# - Orchestror instances are not named
33-
# - CI creates several orchestrator instances
31+
# Need an static class-level ID for metric prefix because:
3432
# - Prometheus requires metrics (their names) to be unique
3533
_instance_id = 0
3634

3735
def __init__(self) -> None:
38-
self._instance_id += 1
39-
if self._instance_id > 1:
36+
OrchestratorMetrics._instance_id += 1
37+
if OrchestratorMetrics._instance_id > 1:
4038
self._prefix = f"megaservice{self._instance_id}"
4139
else:
4240
self._prefix = "megaservice"

0 commit comments

Comments
 (0)