Merge pull request #16 from Aignosi/SIENTIAPDE-1193-conferir-como-a-escrita-de-datetime-ocorre-no-temporal
SIENTIAPDE-1193: Enhance Configuration, Update Dependencies, and Improve Timezone Handling
This commit is contained in:
1
coverage.sh
Executable file
1
coverage.sh
Executable file
@@ -0,0 +1 @@
|
||||
pytest --cov=ingestor --cov-report=html && xdg-open htmlcov/index.html
|
||||
@@ -1,11 +1,11 @@
|
||||
import json
|
||||
from time import sleep
|
||||
from datetime import datetime, timezone
|
||||
from pymongo import MongoClient
|
||||
from kafka import KafkaProducer
|
||||
from kafka.errors import NoBrokersAvailable
|
||||
from sientia_do.notifications.handlers import CoreNotificationHandler as NotificationHandler
|
||||
from sientia_do.notifications.models import NotificationLevel
|
||||
from sientia_do.temporal.constants import now
|
||||
from sientia_do.temporal.activities.base import BaseActivity
|
||||
from sientia_do.observability.logger import Logger
|
||||
import traceback
|
||||
@@ -184,7 +184,7 @@ class DataManager(BaseActivity):
|
||||
collection.insert_one(
|
||||
{
|
||||
**data,
|
||||
"inserted_at": datetime.now(timezone.utc),
|
||||
"inserted_at": now(),
|
||||
}
|
||||
)
|
||||
self.logger.debug(
|
||||
|
||||
@@ -6,6 +6,7 @@ from sientia_do.notifications.models import NotificationLevel
|
||||
from sientia_do.notifications.handlers import CoreNotificationHandler as NotificationHandler
|
||||
from sientia_do.temporal.activities.base import BaseActivity
|
||||
from sientia_do.observability.logger import Logger
|
||||
from sientia_do.temporal.constants import OPC_TIMEZONE, DATETIME_FORMAT_WITH_TZ
|
||||
from ingestor.managers.data_manager import DataManager
|
||||
import ingestor.metrics as metrics
|
||||
|
||||
@@ -261,7 +262,8 @@ class OpcManager(BaseActivity):
|
||||
monitored_item = data.monitored_item
|
||||
value = monitored_item.Value.Value.Value
|
||||
# source_timestamp
|
||||
source_timestamp = monitored_item.Value.SourceTimestamp
|
||||
source_timestamp = monitored_item.Value.SourceTimestamp.replace(
|
||||
tzinfo=OPC_TIMEZONE)
|
||||
tag = str(node)
|
||||
|
||||
self.logger.debug(
|
||||
@@ -276,7 +278,7 @@ class OpcManager(BaseActivity):
|
||||
data = {
|
||||
'tag': tag,
|
||||
'name': self.nodes[str(node)]['tag_name'],
|
||||
'timestamp': source_timestamp.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'timestamp': source_timestamp.strftime(DATETIME_FORMAT_WITH_TZ),
|
||||
'value': value
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
asyncua==1.1.5
|
||||
redis
|
||||
git+ssh://git@github.com/Aignosi/sientia-dataops-library.git@1.4.1
|
||||
git+ssh://git@github.com/Aignosi/sientia-dataops-library.git@1.4.3
|
||||
prometheus_client
|
||||
pymongo
|
||||
@@ -394,7 +394,7 @@ def test_datachange_notification(metrics, opc_manager_subscribed):
|
||||
{
|
||||
"tag": "ns=3;i=1001",
|
||||
"name": "Counter",
|
||||
"timestamp": "2021-01-01 00:00:00",
|
||||
"timestamp": "2021-01-01 00:00:00-0300",
|
||||
"value": 42,
|
||||
},
|
||||
)
|
||||
@@ -403,7 +403,7 @@ def test_datachange_notification(metrics, opc_manager_subscribed):
|
||||
{
|
||||
"tag": "ns=3;i=1001",
|
||||
"name": "Counter",
|
||||
"timestamp": "2021-01-01 00:00:00",
|
||||
"timestamp": "2021-01-01 00:00:00-0300",
|
||||
"value": 42,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
|
||||
replicaCount: 3
|
||||
replicaCount: 2
|
||||
|
||||
# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
|
||||
image:
|
||||
@@ -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: "0.4.2"
|
||||
tag: "0.4.3"
|
||||
|
||||
# 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:
|
||||
@@ -139,7 +139,7 @@ env:
|
||||
- name: GITHUB_REPO_URL
|
||||
value: "git@github.com:Aignosi/sientia-dataops-opc-ingestor.git"
|
||||
- name: GITHUB_BRANCH
|
||||
value: "SIENTIAPDE-1199-revisar-e-testar-observabilidade"
|
||||
value: "SIENTIAPDE-1193-conferir-como-a-escrita-de-datetime-ocorre-no-temporal"
|
||||
- name: PYTHON_APP
|
||||
value: "ingestor.app"
|
||||
|
||||
@@ -173,6 +173,8 @@ env:
|
||||
value: "DEBUG"
|
||||
- name: HTTP_METRICS_PORT
|
||||
value: "9090"
|
||||
- name: OPC_TIMEZONE
|
||||
value: "UTC"
|
||||
|
||||
|
||||
- name: MONGODB_USERNAME
|
||||
|
||||
Reference in New Issue
Block a user