Skip to content

Commit bb3fea6

Browse files
authored
time-series-analytics: Updated kapacitor version (open-edge-platform#1166)
This PR updates the Kapacitor version from 1.7.7 to 1.8.2 and adapts the temperature classifier UDF to work with the new version's API changes. The key change is migrating from iterating over fieldsDouble key-value pairs to using dictionary-style access, which aligns with Kapacitor 1.8.2's updated interface. Signed-off-by: Pooja Kumbharkar <[email protected]>
1 parent 5fb4e19 commit bb3fea6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

microservices/time-series-analytics/docker/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
context: $PWD/../
1111
dockerfile: $PWD/../Dockerfile
1212
args:
13-
KAPACITOR_VERSION: 1.7.7
13+
KAPACITOR_VERSION: 1.8.2
1414
TIMESERIES_UID: ${TIMESERIES_UID}
1515
TIMESERIES_USER_NAME: ${TIMESERIES_USER_NAME}
1616
PYTHON_VERSION: "3.10"

microservices/time-series-analytics/udfs/temperature_classifier.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ def begin_batch(self, begin_req):
5252

5353
def point(self, point):
5454
temp = None
55-
for kv in point.fieldsDouble:
56-
if kv.key == "temperature":
57-
temp = kv.value
58-
break
55+
if "temperature" in point.fieldsDouble:
56+
temp = point.fieldsDouble["temperature"]
57+
5958
if temp is None or isinstance(temp, (int, float)) is False:
6059
logger.error(f"Invalid temperature data received - {temp}")
6160
else:

0 commit comments

Comments
 (0)