SIENTIAPDE-1325

Enhance OPC connection metrics by emitting total connections metric upon connection attempt. This change ensures accurate tracking of connection attempts in the OpcRepository class.
This commit is contained in:
vitor-aignosi
2025-11-07 09:57:43 -03:00
parent c41c11b46f
commit 03dc0978b8

View File

@@ -165,6 +165,7 @@ class OpcRepository(SientiaMonitoring):
'pod_id': self.pod_id, 'pod_id': self.pod_id,
'server_name': self.server_name, 'server_name': self.server_name,
} }
await self.emit_metric(metrics.OPC_CONNECTIONS_TOTAL, tags)
try: try:
self.last_reconnection_time = datetime.now() self.last_reconnection_time = datetime.now()
if self.client is None: if self.client is None:
@@ -176,7 +177,6 @@ class OpcRepository(SientiaMonitoring):
} }
await self.client.connect() await self.client.connect()
await self.emit_metric( await self.emit_metric(
metric_object=metrics.OPC_CONNECTION_STATUS, metric_object=metrics.OPC_CONNECTION_STATUS,
method='set', method='set',
@@ -187,8 +187,6 @@ class OpcRepository(SientiaMonitoring):
value=1, value=1,
) )
await self.emit_metric(metrics.OPC_CONNECTIONS_TOTAL, tags)
return True, {} return True, {}
except Exception as e: except Exception as e:
await self.disconnect() await self.disconnect()