summaryrefslogtreecommitdiffstats
path: root/configd
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@oath.com>2017-10-23 23:27:59 +0200
committerHåkon Hallingstad <hakon@oath.com>2017-10-23 23:27:59 +0200
commit7623522f01cf30171d8b4266c2a0c5726036e0df (patch)
tree0d92937bd547142c865e8d55ff02e977a01abd26 /configd
parent0d7ce451d2d4cda2ee6938573d130bd3ccff092b (diff)
Add total number of service restarts snapshot metric
Diffstat (limited to 'configd')
-rw-r--r--configd/src/apps/sentinel/config-handler.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/configd/src/apps/sentinel/config-handler.cpp b/configd/src/apps/sentinel/config-handler.cpp
index 0527982c99f..e5222b0350b 100644
--- a/configd/src/apps/sentinel/config-handler.cpp
+++ b/configd/src/apps/sentinel/config-handler.cpp
@@ -406,6 +406,16 @@ fillRestarts(vespalib::SimpleMetricSnapshot &snapshot, unsigned long restarts)
}
void
+fillTotalRestarts(vespalib::SimpleMetricSnapshot &snapshot,
+ unsigned long totalRestarts)
+{
+ snapshot.addGauge("sentinel.totalRestarts",
+ "how many times sentinel restarted a service since "
+ "sentinel start",
+ totalRestarts);
+}
+
+void
fillRunning(vespalib::SimpleMetricSnapshot &snapshot, unsigned long running)
{
snapshot.addGauge("sentinel.running",
@@ -429,6 +439,7 @@ ConfigHandler::updateMetrics()
time_t now = time(nullptr);
vespalib::SimpleMetricSnapshot snapshot(_startMetrics.snapshotStart, _startMetrics.snapshotEnd);
fillRestarts(snapshot, _startMetrics.totalRestartsLastSnapshot);
+ fillTotalRestarts(snapshot, _startMetrics.totalRestartsCounter);
fillRunning(snapshot, _startMetrics.currentlyRunningServices);
fillUptime(snapshot, now - _startMetrics.startedTime);
_stateApi.myMetrics.setMetrics(snapshot.asString());