Closed nemesifier closed 4 years ago
Update: after rolling back to https://github.com/openwisp/openwisp-monitoring/commit/0a8b4d8db03c7609277f8c1ff47b71533264c8ee the application starts. I think something in the change which touched deep_merge_dict
in #103 went wrong, maybe there's a slight difference between the version in openwisp-utils and the one which was shipped in here?
Actually in the PR, I removed the influxdb
key. The reason was simple, since queries shall be different for different dbs, we need to store all of them in s separate dat structure than the chart configuration and import it the same from respective timeseries db. So, after moving the queries to influxdb backend
, I removed the influxdb
key as it wasn't needed anymore, I think.
OPENWISP_MONITORING_CHARTS = {
'traffic': {
'unit': ' MB',
'description': (
'Network traffic, download and upload, measured on '
'the interface "{metric.key}", measured in MB.'
),
'query': {
( # difference is here
"SELECT SUM(tx_bytes) / 1000000 AS upload, "
"SUM(rx_bytes) / 1000000 AS download FROM {key} "
"WHERE time >= '{time}' AND content_type = '{content_type}' "
"AND object_id = '{object_id}' GROUP BY time(1d)"
)
},
}
}
If you do it as above everything shall work fine, so it's not a bug I think but this part can be refactored if needed.
@nepython I don't understand:
>>> q = {'query': {
... ( # difference is here
... "SELECT SUM(tx_bytes) / 1000000 AS upload, "
... "SUM(rx_bytes) / 1000000 AS download FROM {key} "
... "WHERE time >= '{time}' AND content_type = '{content_type}' "
... "AND object_id = '{object_id}' GROUP BY time(1d)"
... )
... }
... }
>>> q['query']
set(["SELECT SUM(tx_bytes) / 1000000 AS upload, SUM(rx_bytes) / 1000000 AS download FROM {key} WHERE time >= '{time}' AND content_type = '{content_type}' AND object_id = '{object_id}' GROUP BY time(1d)"])
>>> type(q['query'])
<type 'set'>
The query is a set
, is that intentional?
Why is it a set
?
Did you notice that the examples in the README are pointing out to the configuration I posted in the issue description and therefore that documented feature is now broken?
I see several problems here:
The preferred solution is to fix the code so that the current way of doing it keeps working.
@nepython noticed a problem when I tested the latest master in staging which has this in the
settings.py
:I get the following error:
Please try to replicate it and fix it.