alan-turing-institute / rctab-functions

RCTab function apps to interact with Azure subscriptions.
MIT License
0 stars 1 forks source link

We loose reservation data when combining usage items #42

Open Iain-S opened 2 months ago

Iain-S commented 2 months ago

The Azure API gives us multiple usage items that have the same ID. We combine them into one item, for various reasons. The method we use to combine them can be seen here:

https://github.com/alan-turing-institute/rctab-functions/blob/db8228c0246abfc1cf0a09c0b82bb577031cceae/usage_function/utils/usage.py#L85

If the first item we are given has no reservation id/name and any later ones do, we loose that information (as well as other info, potentially).

A quick fix would be to overwrite any NULL fields and error or warn about any conflicting fields when merging two or more usage items.

Iain-S commented 2 months ago

To verify that this looses info in the real world, look for usage records where there is an amortised cost but no reservation id or name.