Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link capacity/utilization metrics #34

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmke
Copy link
Contributor

@dmke dmke commented Apr 17, 2022

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.

image

If this turn out to be true, I might rename the extra metric to something like wireless-link, or wifi-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
weight  ↑                             weight  ↑
     1 -+               · ·                1 -+              · ·
        |             ·                       |              ·
        |           ·                         |             .
        |         ·                           |            . 
     0 -+ · · · ·                          0 -+ . . . . · `
        |-------+-------+-→ time              |------+-------+-→ time
             t-10min    now                       t-10min    now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant