SIENTIAPDE-1169
Implement OPC writing metrics and enhance OPC class initialization - Added metrics for counting predictions written to the OPC server and monitoring their response times. - Enhanced the OPC class initialization to include the pod ID for better tracking. - Updated the write method to increment the prediction count and observe response times.
This commit is contained in:
@@ -22,6 +22,9 @@ class OPC(BaseActivity):
|
||||
self.notification_handler = notification_handler
|
||||
self.opc_servers = opc_servers
|
||||
|
||||
BaseActivity.__init__(
|
||||
self, logger, notification_handler, set_error_counter=True)
|
||||
|
||||
self.opc_repository: dict[str, OpcRepository] = {}
|
||||
for id, server in opc_servers.items():
|
||||
self.opc_repository[id] = OpcRepository(
|
||||
@@ -34,6 +37,7 @@ class OPC(BaseActivity):
|
||||
server_cert_path=server['server_cert_path'],
|
||||
notification_handler=self.notification_handler,
|
||||
reconnection_interval=server['reconnection_interval'],
|
||||
pod_id=self.pod_id
|
||||
)
|
||||
is_connected, error_data = self.opc_repository[id].connect()
|
||||
if not is_connected:
|
||||
@@ -51,8 +55,6 @@ class OPC(BaseActivity):
|
||||
attachment_content=error_data.get(
|
||||
'attachment_content', None)
|
||||
)
|
||||
BaseActivity.__init__(
|
||||
self, logger, notification_handler, set_error_counter=True)
|
||||
|
||||
def write_data(self, server_id: str, tag: str, data: Any,
|
||||
data_type: str, tag_type: str, metadata: dict[str, Any]) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user