openwisp / openwisp-monitoring

Network monitoring system written in Python and Django, designed to be extensible, programmable, scalable and easy to use by end users: once the system is configured, monitoring checks, alerts and metric collection happens automatically.
https://openwisp.io/docs/dev/monitoring/
Other
165 stars 112 forks source link

[change] Reduced network calls in device metric flow #501 #516

Closed pandafy closed 1 year ago

pandafy commented 1 year ago

Closes #501

Checks:

pandafy commented 1 year ago

The CI is failing due to a mismatch in formatting of timestamp. In the current implementation (master branch), the datetime object gets serialized when passed to celery. Due to this, the time argument of post_metric_write signal is a string. When using UDP for writing timeseries database, the datetime object is not serialized (because the task is executed synchonously) and the formatting of timestamp differs.

Moreover, if we pass a timestamp string to Metric.write method, the post_metric_write signal will use the exact string for time argument which leads to inconsistent results.

I think we should format all incoming timestamps to the ISO format in Metric.write which also includes the timezone information.