wizata-dsapi 2.0.0.dev7__tar.gz → 2.0.0.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wizata_dsapi-2.0.0.dev7/wizata_dsapi.egg-info → wizata_dsapi-2.0.0.dev8}/PKG-INFO +1 -1
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/__init__.py +2 -1
- wizata_dsapi-2.0.0.dev8/wizata_dsapi/graylog_log.py +132 -0
- wizata_dsapi-2.0.0.dev8/wizata_dsapi/version.py +1 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8/wizata_dsapi.egg-info}/PKG-INFO +1 -1
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi.egg-info/SOURCES.txt +1 -0
- wizata_dsapi-2.0.0.dev7/wizata_dsapi/version.py +0 -1
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/LICENSE.txt +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/README.rst +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/setup.cfg +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/setup.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/api_config.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/api_dto.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/api_interface.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/bucket.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/business_label.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/context.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/dashboard.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/dataframe_toolkit.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/datapoint.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/datastore.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/ds_dataframe.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/dsapi_json_encoder.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/edge_device.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/evaluation.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/execution.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/execution_log.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/experiment.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/group_system.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/ilogger.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/insight.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/mlmodel.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/mobile_asset.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/model_toolkit.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/models/__init__.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/models/common.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/notification.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/paged_query_result.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/pipeline.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/pipeline_image.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/plot.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/plots/__init__.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/plots/common.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/request.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/script.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/scripts/__init__.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/scripts/common.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/search.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/solution_component.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/streamlit_utils.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/template.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/trigger.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/twin.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/twinregistration.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/wizard_function.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/wizard_request.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/wizata_dsapi_client.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi/words.py +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi.egg-info/requires.txt +0 -0
- {wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi.egg-info/top_level.txt +0 -0
|
@@ -53,4 +53,5 @@ from .search import FilterOperator, SearchQuery, SortOption, GroupSearchQuery
|
|
|
53
53
|
from .notification import NotificationScope, DeviceToken, AlertRule, AlertActive, MonitoredDatapoint
|
|
54
54
|
from .edge_device import EdgeDevice, EdgeDeviceStatus, EdgeDeviceType
|
|
55
55
|
from .dashboard import Dashboard, DashboardType
|
|
56
|
-
from .mobile_asset import MobileAssetTile, MobileAssetTileType, MobileAssetConfig
|
|
56
|
+
from .mobile_asset import MobileAssetTile, MobileAssetTileType, MobileAssetConfig
|
|
57
|
+
from .graylog_log import GraylogLog
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class GraylogLog:
|
|
6
|
+
"""
|
|
7
|
+
DTO for a single Graylog log entry.
|
|
8
|
+
|
|
9
|
+
Represents a log message from Graylog with standard GELF fields
|
|
10
|
+
plus Wizata custom fields (appId, edgeDeviceId, etc.).
|
|
11
|
+
|
|
12
|
+
Timestamps are always milliseconds (int) in serialized form.
|
|
13
|
+
|
|
14
|
+
:ivar int timestamp: event timestamp in milliseconds
|
|
15
|
+
:ivar str message: log message text
|
|
16
|
+
:ivar int level: syslog severity level (0=Emergency .. 7=Debug)
|
|
17
|
+
:ivar str source: source hostname
|
|
18
|
+
:ivar str app_id: application identifier
|
|
19
|
+
:ivar str edge_device_id: IoT Edge device identifier
|
|
20
|
+
:ivar str env: environment name
|
|
21
|
+
:ivar str tenant_id: tenant identifier
|
|
22
|
+
:ivar dict extra: any additional fields from the Graylog message
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def from_dict(cls, data: dict) -> "GraylogLog":
|
|
27
|
+
"""
|
|
28
|
+
Deserialize a Graylog message dict into a GraylogLog.
|
|
29
|
+
|
|
30
|
+
Graylog returns timestamps as ISO 8601 strings — these are
|
|
31
|
+
converted to millisecond timestamps.
|
|
32
|
+
|
|
33
|
+
:param data: Graylog message dict (from API response message field).
|
|
34
|
+
"""
|
|
35
|
+
timestamp = data.get("timestamp")
|
|
36
|
+
timestamp_ms = None
|
|
37
|
+
if timestamp is not None:
|
|
38
|
+
if isinstance(timestamp, (int, float)):
|
|
39
|
+
timestamp_ms = int(timestamp)
|
|
40
|
+
elif isinstance(timestamp, str):
|
|
41
|
+
timestamp_ms = cls._parse_graylog_timestamp(timestamp)
|
|
42
|
+
|
|
43
|
+
known_fields = {
|
|
44
|
+
"timestamp", "message", "level", "source",
|
|
45
|
+
"appId", "app_id",
|
|
46
|
+
"edgeDeviceId", "edge_device_id",
|
|
47
|
+
"env", "tenantId", "tenant_id",
|
|
48
|
+
"gl2_message_id", "gl2_remote_ip", "gl2_remote_port",
|
|
49
|
+
"gl2_source_input", "gl2_source_node",
|
|
50
|
+
"streams", "_id", "facility",
|
|
51
|
+
}
|
|
52
|
+
extra = {k: v for k, v in data.items() if k not in known_fields}
|
|
53
|
+
|
|
54
|
+
return cls(
|
|
55
|
+
timestamp=timestamp_ms,
|
|
56
|
+
message=data.get("message"),
|
|
57
|
+
level=int(data["level"]) if "level" in data and data["level"] is not None else None,
|
|
58
|
+
source=data.get("source"),
|
|
59
|
+
app_id=data.get("appId") or data.get("app_id"),
|
|
60
|
+
edge_device_id=data.get("edgeDeviceId") or data.get("edge_device_id"),
|
|
61
|
+
env=data.get("env"),
|
|
62
|
+
tenant_id=data.get("tenantId") or data.get("tenant_id"),
|
|
63
|
+
extra=extra if extra else None,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
def __init__(self,
|
|
67
|
+
timestamp: Optional[int] = None,
|
|
68
|
+
message: Optional[str] = None,
|
|
69
|
+
level: Optional[int] = None,
|
|
70
|
+
source: Optional[str] = None,
|
|
71
|
+
app_id: Optional[str] = None,
|
|
72
|
+
edge_device_id: Optional[str] = None,
|
|
73
|
+
env: Optional[str] = None,
|
|
74
|
+
tenant_id: Optional[str] = None,
|
|
75
|
+
extra: Optional[dict] = None):
|
|
76
|
+
self.timestamp = timestamp
|
|
77
|
+
self.message = message
|
|
78
|
+
self.level = level
|
|
79
|
+
self.source = source
|
|
80
|
+
self.app_id = app_id
|
|
81
|
+
self.edge_device_id = edge_device_id
|
|
82
|
+
self.env = env
|
|
83
|
+
self.tenant_id = tenant_id
|
|
84
|
+
self.extra = extra or {}
|
|
85
|
+
|
|
86
|
+
def to_dict(self) -> dict:
|
|
87
|
+
"""
|
|
88
|
+
Serialize to a camelCase dict.
|
|
89
|
+
Timestamps are millisecond integers.
|
|
90
|
+
"""
|
|
91
|
+
data = {}
|
|
92
|
+
if self.timestamp is not None:
|
|
93
|
+
data["timestamp"] = self.timestamp
|
|
94
|
+
if self.message is not None:
|
|
95
|
+
data["message"] = self.message
|
|
96
|
+
if self.level is not None:
|
|
97
|
+
data["level"] = self.level
|
|
98
|
+
if self.source is not None:
|
|
99
|
+
data["source"] = self.source
|
|
100
|
+
if self.app_id is not None:
|
|
101
|
+
data["appId"] = self.app_id
|
|
102
|
+
if self.edge_device_id is not None:
|
|
103
|
+
data["edgeDeviceId"] = self.edge_device_id
|
|
104
|
+
if self.env is not None:
|
|
105
|
+
data["env"] = self.env
|
|
106
|
+
if self.tenant_id is not None:
|
|
107
|
+
data["tenantId"] = self.tenant_id
|
|
108
|
+
if self.extra:
|
|
109
|
+
data.update(self.extra)
|
|
110
|
+
return data
|
|
111
|
+
|
|
112
|
+
@staticmethod
|
|
113
|
+
def _parse_graylog_timestamp(ts_str: str) -> Optional[int]:
|
|
114
|
+
"""
|
|
115
|
+
Parse a Graylog ISO 8601 timestamp string to milliseconds.
|
|
116
|
+
Graylog format: '2024-01-15T10:30:00.123Z' or '2024-01-15 10:30:00.123'
|
|
117
|
+
"""
|
|
118
|
+
formats = [
|
|
119
|
+
"%Y-%m-%dT%H:%M:%S.%fZ",
|
|
120
|
+
"%Y-%m-%dT%H:%M:%SZ",
|
|
121
|
+
"%Y-%m-%dT%H:%M:%S.%f",
|
|
122
|
+
"%Y-%m-%dT%H:%M:%S",
|
|
123
|
+
"%Y-%m-%d %H:%M:%S.%f",
|
|
124
|
+
"%Y-%m-%d %H:%M:%S",
|
|
125
|
+
]
|
|
126
|
+
for fmt in formats:
|
|
127
|
+
try:
|
|
128
|
+
dt = datetime.strptime(ts_str, fmt).replace(tzinfo=timezone.utc)
|
|
129
|
+
return int(dt.timestamp() * 1000)
|
|
130
|
+
except ValueError:
|
|
131
|
+
continue
|
|
132
|
+
return None
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.0.dev8"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.0.0.dev7"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wizata_dsapi-2.0.0.dev7 → wizata_dsapi-2.0.0.dev8}/wizata_dsapi.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|