Skip to content

Commit e3a4c7f

Browse files
author
Thierry
committed
Use float instead int
1 parent ffff482 commit e3a4c7f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/process.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def load_metric(metric: Metrics, timestamp, options: Options):
4949
last_dot = element["values"][-1]
5050

5151
# Convert counter value from str to int
52-
last_dot = last_dot[0], int(last_dot[1])
52+
last_dot = last_dot[0], float(last_dot[1])
5353

5454
logger.debug(f"Found dot {last_dot} for {metric.output}{pretty_labels(labels)}")
5555
recatch_dots_by_key[key] = last_dot
@@ -72,7 +72,7 @@ async def load_metric(metric: Metrics, timestamp, options: Options):
7272
if key in recatch_dots_by_key:
7373

7474
# Store the last seen input counter
75-
metric.previous_values_by_key[key] = int(values[-1][1])
75+
metric.previous_values_by_key[key] = float(values[-1][1])
7676

7777
# Remove the current metric from recatch_dots_by_key.
7878
last_timestamp, counter_value = recatch_dots_by_key.pop(key)
@@ -84,7 +84,7 @@ async def load_metric(metric: Metrics, timestamp, options: Options):
8484
for i in range(len(catchup_values) - 1):
8585
tn, vn = catchup_values[i]
8686
tnp, vnp = catchup_values[i + 1]
87-
vn, vnp, tn, tnp = int(vn), int(vnp), float(tn), float(tnp)
87+
vn, vnp, tn, tnp = float(vn), float(vnp), float(tn), float(tnp)
8888
increment = vnp - vn if vnp >= vn else vnp
8989
input_counter_incr += increment
9090

0 commit comments

Comments
 (0)