Closed kevinkk525 closed 3 years ago
Haven't seen this to be honest. Is this on a new node?
I'll try to reproduce but it seems like I missed handling this one properly. It relies on get
to return default [None]
in case storageDaily is missing. Though [None]
has no [-1] element and so fails.
I think this is what happens here and so data = sat['sat_data'].get('storageDaily', [{}])[-1]
should fix it, need to test.
I'm surprised you missed it, it occured on Nov 1st but you can wait for Dec 1st, then it'll happen again. It happened on 3 nodes, all rather old.
oh you are right - checking history I have no metrics for start of the month as well :) that makes sense, thanks for reporting it 👍
Reproduced the issue and this should fix it https://github.com/anclrii/Storj-Exporter/commit/f85ea79e529a0dc558651c0a53769b54902afd53
Indeed api just returns {"storageDaily": null}
in that case and so [-1]
fails as the value is not a list. I don't think there's a better option then try: except: as there's no safe way of retrieving list items similar to dictionary get method.
@kevinkk525 if you are interested, most commits are now auto building docker images and there's anclrii/storj-exporter:dev
image available to test.
That looks good to me! Should work, my solution was similar, but only for this specific metric. It's good that you use a solution for multiple metrics. I'll give it a try on Dec 1st!
This is now merged into master and latest image
I guess you'll already have noticed that too since the dashboard looks pretty empty now xD
I "fixed" it locally by try: except: data=None Imho though this is an API error and I'll raise it in the storagenode repo too. If the storagenode doesn't have data for the current day, it should show 0 and not None. Or do you disagree?