<p style="white-space: pre-wrap; word-wrap: break-word;">Hi,</p><p style="white-space: pre-wrap; word-wrap: break-word;">Thanks again for taking a look. Reply to your comment is maybe long but hopefully clear.</p><p style="white-space: pre-wrap; word-wrap: break-word;">-Michael</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234/4/src/osmo-bsc/bts.c">File src/osmo-bsc/bts.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234/4/src/osmo-bsc/bts.c@586">Patch Set #4, Line 586:</a> <code style="font-family:monospace,monospace">  int downtime_seconds = BTS_DOWNTIME_SAMPLE_INTERVAL - uptime_seconds;</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">I'm still not getting it, I'm sorry. Or maybe I'm getting it but I still find it really strange. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Let's back up a bit maybe. Currently there is no way determine a BTS uptime other than by polling it via the VTY. If the BSC restarts for some reason, all uptime tracking is lost. I wanted to have the uptime available via the statsd interface so each BTS uptime during any given period can be known without risking losing state in a restart.</p><p style="white-space: pre-wrap; word-wrap: break-word;">So, originally I wrote this to run every second and count uptime. Are we up? Good, increment the uptime counter. This value is summed every X seconds when statsd runs and the value is exported. Every interval of statsd would contain between 0 and X seconds of uptime. I can sum these intervals, for example, for an hour and the difference between that number and 3600 will be my downtime. Straightforward I thought.</p><p style="white-space: pre-wrap; word-wrap: break-word;">This approach was rejected. It ran too often, abused the counter interface, and counted uptime instead of downtime. OK, so now I've changed to using a stat_item, only running every INTERVAL seconds and counting downtime.</p><p style="white-space: pre-wrap; word-wrap: break-word;">The BTS_DOWNTIME_SAMPLE_INTERVAL value now represents the maximum amount of downtime that we would be willing to let go missing if a restart would occur because it isn't getting pushed into the statsd system. When we execute the periodic timer to calculate downtime we see how many seconds of uptime have elapsed and take the difference from the interval to determine downtime.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Downtime is added to the stat_item. When the statsd system exports these values every X seconds, we have between 0 and X seconds of downtime in that period. Sum up all these periods and you can see total downtime for each BTS during any given timeframe.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Suggestions welcome. I've tried my best to address concerns but am running out of ideas.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234">change 23234</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib17674bbe95e828cebff12de9e0b30f06447ef6c </div>
<div style="display:none"> Gerrit-Change-Number: 23234 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: iedemam <michael@kapsulate.com> </div>
<div style="display:none"> Gerrit-Assignee: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 30 Apr 2021 14:43:17 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: iedemam <michael@kapsulate.com> </div>
<div style="display:none"> Comment-In-Reply-To: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>