We currently sample the count of active channels on a 5-minute periodic timer, and write the results into the usagedb. The munin plugin comes along (on a 5-minute cronjob) and samples the usagedb, putting the results into a graph.
A brief connection that gets sampled will appear to last for 5 minutes. A brief connection that doesn't get sampled won't appear to exist at all.
We could make the usagedb data more accurate by proactively updating the database each time a connection is made, and again when it is dropped. We'd still need the 5-minute timer to refresh the "updated" time (so a server crash, which stops updating the connection counts but also stops updating the "updated" timestamp, doesn't make it look like those connections are still established). But we wouldn't need to sample the connection counts during that timer.
This would increase the usagedb workload: two additional UPDATEs per connection. Currently we perform one INSERT per paired connection (when two peers find each other, we write the usage record after the first of them disconnect), or one INSERT per non-paired connection (when a peer fails the handshake process, or gives up without finding their peer), plus the 5-minute timer UPDATE (which in fact is currently a DELETE plus an INSERT).
OTOH, munin is only sampling every 5 minutes anyways, so this couldn't improve the accuracy of the presented data. It'd only help if you had some other sort of monitoring tool, which samples more frequently than the 5-minute timer.
We currently sample the count of active channels on a 5-minute periodic timer, and write the results into the usagedb. The munin plugin comes along (on a 5-minute cronjob) and samples the usagedb, putting the results into a graph.
A brief connection that gets sampled will appear to last for 5 minutes. A brief connection that doesn't get sampled won't appear to exist at all.
We could make the usagedb data more accurate by proactively updating the database each time a connection is made, and again when it is dropped. We'd still need the 5-minute timer to refresh the "updated" time (so a server crash, which stops updating the connection counts but also stops updating the "updated" timestamp, doesn't make it look like those connections are still established). But we wouldn't need to sample the connection counts during that timer.
This would increase the usagedb workload: two additional UPDATEs per connection. Currently we perform one INSERT per paired connection (when two peers find each other, we write the usage record after the first of them disconnect), or one INSERT per non-paired connection (when a peer fails the handshake process, or gives up without finding their peer), plus the 5-minute timer UPDATE (which in fact is currently a DELETE plus an INSERT).
OTOH, munin is only sampling every 5 minutes anyways, so this couldn't improve the accuracy of the presented data. It'd only help if you had some other sort of monitoring tool, which samples more frequently than the 5-minute timer.