SIENTIAPDE-1325
SIENTIAPDE-1325 Add OPC server name configuration and update repository handling - Introduced a new environment variable `OPC_SERVER_NAME` in values.yaml with a default value. - Updated the OPC class to include `server_name` when initializing OpcRepository. - Enhanced the configuration builder to retrieve `OPC_SERVER_NAME` from the environment. - Adjusted OpcRepository to store and utilize the `server_name` for metric emissions.
This commit is contained in:
@@ -88,6 +88,7 @@ def build_opc_config() -> dict[str, Any]:
|
||||
return {
|
||||
getenv('OPC_ID', '1'): {
|
||||
'id': getenv('OPC_ID', '1'),
|
||||
'server_name': getenv('OPC_SERVER_NAME', 'default_server'),
|
||||
'url': getenv('OPC_URL', 'opc.tcp://localhost:4840'),
|
||||
'server_uri': getenv('OPC_SERVER_URI', 'opc.tcp://localhost:4840'),
|
||||
'cert_path': getenv('OPC_CERT_PATH', None),
|
||||
|
||||
@@ -46,6 +46,7 @@ class OpcRepository(SientiaMonitoring):
|
||||
self,
|
||||
opc_id: str,
|
||||
url: str,
|
||||
server_name: str,
|
||||
logger: Logger,
|
||||
notification_handler: NotificationHandler,
|
||||
metrics_controller: MetricsController,
|
||||
@@ -57,6 +58,7 @@ class OpcRepository(SientiaMonitoring):
|
||||
):
|
||||
self.url = url
|
||||
self.id = opc_id
|
||||
self.server_name = server_name
|
||||
self.server_uri = server_uri
|
||||
self.cert_path = cert_path
|
||||
self.private_key_path = private_key_path
|
||||
@@ -172,7 +174,7 @@ class OpcRepository(SientiaMonitoring):
|
||||
|
||||
tags = {
|
||||
'pod_id': self.pod_id,
|
||||
'opc_server_id': self.id,
|
||||
'server_name': self.server_name,
|
||||
}
|
||||
|
||||
await self.emit_metric(
|
||||
|
||||
Reference in New Issue
Block a user