Skip to content

Commit d387efb

Browse files
authored
fix(measure): push networks loadbalancers metrics error (#185)
1 parent da8f91c commit d387efb

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

rootfs/api/management/commands/measure_loadbalancers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ def _measure_loadbalancers(self, app_map, timestamp):
2525
stop = timestamp - (timestamp % 3600)
2626
start = stop - 3600
2727
loadbalancers = []
28-
for metric, (_, value) in async_to_sync(monitor.query_loadbalancer(
29-
app_map.keys(), start, stop)):
28+
for item in async_to_sync(monitor.query_loadbalancer)(app_map.keys(), start, stop): # noqa
29+
metric = item["metric"]
30+
_, value = item["value"]
3031
ip = metric["ip"]
3132
namespace = metric["namespace"]
3233
owner_id = app_map[namespace].owner_id

rootfs/api/management/commands/measure_networks.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ def _measure_networks(self, app_map, timestamp):
1919
stop = timestamp - (timestamp % 3600)
2020
start = stop - 3600
2121
networks = []
22-
for metric, (_, value) in async_to_sync(monitor.query_network_receive_flow(
23-
app_map.keys(), start, stop)):
22+
for item in async_to_sync(monitor.query_network_receive_flow)(app_map.keys(), start, stop): # noqa
23+
metric = item["metric"]
24+
_, value = item["value"]
2425
networks.append({
2526
"app_id": str(app_map[metric['namespace']].uuid),
2627
"owner": app_map[metric['namespace']].owner_id,
@@ -33,8 +34,9 @@ def _measure_networks(self, app_map, timestamp):
3334
},
3435
"timestamp": start
3536
})
36-
for metric, (_, value) in async_to_sync(monitor.query_network_transmit_flow(
37-
app_map.keys(), start, stop)):
37+
for item in async_to_sync(monitor.query_network_transmit_flow)(app_map.keys(), start, stop): # noqa
38+
metric = item["metric"]
39+
_, value = item["value"]
3840
networks.append({
3941
"app_id": str(app_map[metric['namespace']].uuid),
4042
"owner": app_map[metric['namespace']].owner_id,

rootfs/api/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,4 +1356,3 @@ async def proxy(self, request, username, path):
13561356
return JsonResponse(data, status=status)
13571357

13581358
get = post = proxy
1359-

0 commit comments

Comments
 (0)