scaphandre icon indicating copy to clipboard operation
scaphandre copied to clipboard

Softawere - power_data.json is truncated

Open lcanagui opened this issue 1 year ago • 4 comments

Bug description

I try to install Softawere following the documentation on a private physical Ubuntu server. I get an error in the boagent while reading the power_data.json file exported by Scaphandre, cf https://gitlab.com/softawere-hackathon/softawere/-/issues/16

To Reproduce

  1. docker-compose up in the softawere repository
  2. Check the json exported file by Scpahandre
cat /var/lib/docker/volumes/softawere_powerdata/_data/power_data.json
{"host":{"consumption":20424752.0,"timestamp":1685749774.9347048,"components":{"disks":[{"disk_type":"Unknown","disk_mount_point":"/etc/hosts".......
.....
un/containerd/containerd.sock","pid":293397,"resources_usage":null,"consumption":1704.8922,"timestamp":1685751231.2300694,"container":null}],"sockets":[{"id":0,"consumption":13674940.0,"domains":[{"name":"dram","consumption":7959161.0,"timestamp":1685751231.196572},{"name":"core","consumption":5104381.0,"timestamp":1685751231.196522}],"timestamp":1685751231.1958687}]}{"host":{"consumption":13545267.0,"timestamp":

The json file is truncated, is it a bug ?

Environment

Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-149-generic x86_64)

lcanagui avatar Jun 03 '23 00:06 lcanagui

Possibly linked to issue #359 ?

demeringo avatar Mar 13 '24 09:03 demeringo

Hi !

Thank you for documenting this issue, as said in #359 I tried a PR including a different initialization of the BufWriter, setting the size of the buffer.

Output of json exporter changes a bit too, as we ensure there is an opening '[', also ',' separators between host reports and an ending ']' when it is finished.

Let me know if you can try this branch before it makes it to dev, I'd love to hear feedbacks.

bpetit avatar Apr 23 '24 10:04 bpetit

Hello, it seems that the ']' is still missing ! One should be careful to delete it at the concatenation ! To test: scaphandre json -s 10 -f power_data.json

lcanagui avatar Apr 26 '24 07:04 lcanagui

It does, when there is no timeout and the collection is not finished. As discussed in your case this is up to boagent to manage this output properly. Let's discuss about it in boagent or softawere issues :)

bpetit avatar Apr 26 '24 23:04 bpetit