diff --git a/laborious/metrics.py b/laborious/metrics.py index 6580eef..9d422fb 100644 --- a/laborious/metrics.py +++ b/laborious/metrics.py @@ -30,12 +30,12 @@ PREDICTION_RESPONSE_TIME_MONITOR = Histogram( PREDICTION_OPC_WRITING_COUNT = Counter( "laborious_prediction_opc_writing_count", "Number of predictions written to the OPC server", - CORE_LABELS, + [CORE_LABELS, "opc_server_id"], ) PREDICTION_OPC_WRITING_RESPONSE_TIME_MONITOR = Histogram( "laborious_prediction_opc_writing_response_time_monitor", "Current response time of each prediction written to the OPC server", - CORE_LABELS, + [CORE_LABELS, "opc_server_id"], buckets=[0.01, 0.05, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 10.0] ) diff --git a/laborious/utils/repository/opc_repository.py b/laborious/utils/repository/opc_repository.py index e22288e..212ea5d 100644 --- a/laborious/utils/repository/opc_repository.py +++ b/laborious/utils/repository/opc_repository.py @@ -266,7 +266,8 @@ class OpcRepository(): metrics.PREDICTION_OPC_WRITING_COUNT.labels( pod_id=self.pod_id, model_name=metadata['model_name'], - pipeline_name=metadata['workflow_name'] + pipeline_name=metadata['workflow_name'], + opc_server_id=self.id ).inc() end_time = time.time() @@ -274,7 +275,8 @@ class OpcRepository(): metrics.PREDICTION_OPC_WRITING_RESPONSE_TIME_MONITOR.labels( pod_id=self.pod_id, model_name=metadata['model_name'], - pipeline_name=metadata['workflow_name'] + pipeline_name=metadata['workflow_name'], + opc_server_id=self.id ).observe(response_time) except Exception as e: