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:
@@ -120,6 +120,18 @@ OPC_CONNECTION_STATUS = Gauge(
|
||||
['pod_id', 'opc_server_id'],
|
||||
)
|
||||
|
||||
OPC_CONNECTION_COUNT = Counter(
|
||||
'laborious_opc_connection_count',
|
||||
'Number of connections to the OPC server',
|
||||
['pod_id', 'opc_server_id'],
|
||||
)
|
||||
|
||||
OPC_CONNECTION_ERROR_COUNT = Counter(
|
||||
'laborious_opc_connection_error_count',
|
||||
'Number of errors connecting to the OPC server',
|
||||
['pod_id', 'opc_server_id'],
|
||||
)
|
||||
|
||||
# ================== Model metrics ==================
|
||||
|
||||
MODEL_READ_LAG = Histogram(
|
||||
|
||||
@@ -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}',
|
||||
|
||||
@@ -11,7 +11,7 @@ image:
|
||||
# This sets the pull policy for images.
|
||||
pullPolicy: Always
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: "1.0.1"
|
||||
tag: "1.1.0"
|
||||
|
||||
0# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
imagePullSecrets:
|
||||
@@ -151,7 +151,7 @@ env:
|
||||
- name: GITHUB_REPO_URL
|
||||
value: "git@github.com:Aignosi/sientia-dataops-laborious_temporal.git"
|
||||
- name: GITHUB_BRANCH
|
||||
value: "fix/SIENTIAPDE-1314-ajustes-nas-camadas-de-monitoramento-do-sientia"
|
||||
value: "feature/SIENTIAPDE-1325-adicionar-metricas-especificas-de-operacoes-externas"
|
||||
- name: PYTHON_APP
|
||||
value: "laborious.worker.worker"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user