SIENTIAPDE-1325

Update image tag and enhance OPC metrics tracking

- Bumped image tag from "1.0.1" to "1.1.0" in values.yaml.
- Added new metrics for OPC connection count and error count in metrics.py.
- Refactored OPC connection handling in opc_repository.py to emit new metrics for connection status, count, and errors.
This commit is contained in:
vitor-aignosi
2025-11-06 16:59:02 -03:00
parent 1695df70ae
commit 507aded950
3 changed files with 25 additions and 7 deletions

View File

@@ -170,23 +170,29 @@ class OpcRepository(SientiaMonitoring):
}
await self.client.connect()
tags = {
'pod_id': self.pod_id,
'opc_server_id': self.id,
}
await self.emit_metric(
metric_object=metrics.OPC_CONNECTION_STATUS,
method='set',
tags={
'pod_id': self.pod_id,
'opc_server_id': self.id,
},
tags=tags,
value=1,
)
await self.emit_metric(metrics.OPC_CONNECTION_COUNT, tags)
return True, {}
except Exception as e:
self.disconnect()
await self.disconnect()
trace = traceback.format_exc()
self.logger.custom_error(trace, self.metadata)
await self.emit_metric(metrics.OPC_CONNECTION_ERROR_COUNT, tags)
return False, {
'notification_id': f'OPC_CONNECTION_ERROR_{self.id}',
'message': f'Failed to connect to OPC server: {e}',