VictoriaMetrics compatibility
Hi Fabio,
I wanted to run your script using VictoriaMetrics instead of InfluxDB. Upon the first run I've got this error:
2023-01-27 09:05:21,127 - 520 - DEBUG - Passing through key word arguments {}.
2023-01-27 09:05:21,133 - 1003 - DEBUG - Starting new HTTPS connection (1): api.fitbit.com:443
2023-01-27 09:05:21,366 - 456 - DEBUG - https://api.fitbit.com:443 "GET /1/user/-/profile.json HTTP/1.1" 200 None
2023-01-27 09:05:21,373 - 433 - INFO - User is member since: 2023-01-21 (ts: 1674255600.0)
2023-01-27 09:05:21,377 - 228 - DEBUG - Starting new HTTP connection (1): 127.0.0.1:8428
2023-01-27 09:05:21,383 - 456 - DEBUG - http://127.0.0.1:8428 "GET /query?q=SHOW+DATABASES&db=fitbit HTTP/1.1" 200 None
2023-01-27 09:05:21,392 - 456 - DEBUG - http://127.0.0.1:8428 "POST /query?q=CREATE+DATABASE+%22fitbit%22&db=fitbit HTTP/1.1" 200 None
2023-01-27 09:05:21,399 - 228 - DEBUG - Starting new HTTP connection (1): 127.0.0.1:8428
2023-01-27 09:05:21,403 - 456 - DEBUG - http://127.0.0.1:8428 "GET /query?q=SELECT+first%28activityCalories%29+FROM+activities%3B&db=fitbit HTTP/1.1" 200 None
2023-01-27 09:05:21,404 - 279 - DEBUG - get_first: res: ResultSet({'('databases', None)': [{'name': '_internal'}]})
Traceback (most recent call last):
File "/home/e/tmp/git/fitbit-api-exporter/./api_poller.py", line 522, in <module>
run_api_poller()
File "/home/e/tmp/git/fitbit-api-exporter/./api_poller.py", line 465, in run_api_poller
first_ts = get_first_timestamp_for_measurement(db_client, meas, key_series, min_ts=cur_day)
File "/home/e/tmp/git/fitbit-api-exporter/./api_poller.py", line 281, in get_first_timestamp_for_measurement
return parse(list(res.get_points())[0]['time'], ignoretz=True)
KeyError: 'time'
To me, it makes a point not to have any attributes for non-existing records. I wonder, though, if it is a VM-related bug?