Add link capacity/utilization metrics #34
Draft
+490
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds up/downlink capacity and utilization metrics. They are optional and can be enabled with
--extra-metrics=link
.I'm currently not 100% clear on a few points, so I'll leave this PR as draft for now. I'm going to run this for a few days, and maybe update the PR accordingly:
Wifi-bridges only?
I don't know to which interface the link fields belong. It might be, that these metrics are only available for WiFi bridges (such as Nano- or Gigabeam devices).
The numbers retrieved from the API correspond at least with this observation.
If this turn out to be true, I might rename the extra metric to something like
wireless-link
, orwifi-bridge
, so similar.Mean calculation
Currently, the response returned from
/devices/{id}/statistics
contains (at minimum) 1 full hour of link data, and it seems they are reported in 15s intervals. The capacity values look highly volatile, as do the utilization ratios (they represent a function of network traffic / capacity).To limit the amount of data to be computed, I've opted to only take the last 10 minutes into account. To combat the volatility (but not loose anomalies, like a sudden drop in capacity) I'm calculating a weighted mean over the data, where the weight for a data point decreases as its age increases.
I've implemented a linear interpolation for the weight between "now" and "10 min ago", but I might switch to a exponential interpolation and/or adjust the window size.
Comparison curves