Skip to content

Commit 62ceaa7

Browse files
committed
fix(controller): measure api err
1 parent b7d38bd commit 62ceaa7

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

rootfs/api/management/commands/measure_networks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _measure_networks(self, app_map, timestamp):
2828
"type": "network",
2929
"unit": "bytes",
3030
"usage": record["rx_bytes"] + record["tx_bytes"],
31-
"timestamp": "%d" % start
31+
"timestamp": start
3232
})
3333
send_measurements.delay(networks)
3434

rootfs/api/models/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,15 +1168,15 @@ def to_measurements(self, timestamp: float):
11681168
"type": "cpu",
11691169
"unit": "milli",
11701170
"usage": unit_to_millicpu(config.cpu.get(container_type)) * scale,
1171-
"timestamp": "%f" % timestamp
1171+
"timestamp": int(timestamp)
11721172
})
11731173
measurements.append({
1174-
"app_id": self.app_id,
1174+
"app_id": self.id,
11751175
"owner": self.owner_id,
11761176
"name": container_type,
11771177
"type": "memory",
11781178
"unit": "bytes",
11791179
"usage": unit_to_bytes(config.memory.get(container_type)) * scale,
1180-
"timestamp": "%f" % timestamp
1180+
"timestamp": int(timestamp)
11811181
})
11821182
return measurements

rootfs/api/models/resource.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ def detach_resource(self, *args, **kwargs):
230230

231231
def to_measurements(self, timestamp: float):
232232
return [{
233-
"app_id": str(self.app_id),
234-
"owner": str(self.owner_id),
233+
"app_id": self.app.id,
234+
"owner": self.owner_id,
235235
"name": self.name,
236236
"type": self.plan,
237237
"unit": "number",
238238
"usage": 1,
239-
"timestamp": "%f" % timestamp
239+
"timestamp": int(timestamp)
240240
}]

rootfs/api/models/volume.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ def log(self, message, level=logging.INFO):
6565

6666
def to_measurements(self, timestamp: float):
6767
return [{
68-
"app_id": str(self.app_id),
69-
"owner": str(self.owner_id),
68+
"app_id": self.app.id,
69+
"owner": self.owner_id,
7070
"name": self.name,
7171
"type": "volume",
7272
"unit": "bytes",
7373
"usage": unit_to_bytes(self.size),
74-
"timestamp": "%f" % timestamp
74+
"timestamp": int(timestamp)
7575
}]
7676

7777
def __str__(self):

0 commit comments

Comments
 (0)