grafana / unused

CLI tool, Prometheus exporter, and Go module to list your unused disks in all cloud providers
Apache License 2.0
51 stars 1 forks source link

Fix GCP disk size conversion #99

Closed paulajulve closed 1 month ago

paulajulve commented 1 month ago

Turns out that the GB units Google uses in their API responses are actually binary GB, aka, GiB. So the conversion to bytes needs a different factor.

Relevant docs are linked in the comment over the function, for future reference.

paulajulve commented 1 month ago

Sorry, ~I~ the automation undid all the approves 💩

Since we're only using 2^30 now, I've centralised the constant in the disk.go file and used it all over. And I've added tests for all 3 CSPs for the size both in GB and bytes. I didn't think it was worth adding that test to the interface, since what we want to guarantee is that the logic is sound within each specific provider, and that in turn already guarantees the interface.

paulajulve commented 1 month ago

Dammit! I broke the tests 😅 brb