SIENTIAPDE-1325

Refactor OPC metrics in metrics.py and opc_repository.py

- Replaced existing OPC connection metrics with new metrics for total connections and failed connections.
- Updated the OPC connection status metric to include server URL and adjusted corresponding metric emissions in opc_repository.py.
This commit is contained in:
vitor-aignosi
2025-11-07 08:37:08 -03:00
parent 507aded950
commit 4136c116da
2 changed files with 14 additions and 16 deletions

View File

@@ -182,7 +182,7 @@ class OpcRepository(SientiaMonitoring):
value=1,
)
await self.emit_metric(metrics.OPC_CONNECTION_COUNT, tags)
await self.emit_metric(metrics.OPC_CONNECTIONS_TOTAL, tags)
return True, {}
except Exception as e:
@@ -191,7 +191,7 @@ class OpcRepository(SientiaMonitoring):
trace = traceback.format_exc()
self.logger.custom_error(trace, self.metadata)
await self.emit_metric(metrics.OPC_CONNECTION_ERROR_COUNT, tags)
await self.emit_metric(metrics.OPC_CONNECTIONS_FAILED, tags)
return False, {
'notification_id': f'OPC_CONNECTION_ERROR_{self.id}',