summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-08-20 15:05:20 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-20 15:05:20 +0200
commitde0a1c41c4b40234b14f912ab4ff6b6260d15b7f (patch)
tree9f78db43111e5932a682a4c9eb7b8b942bdb962e
parent0f79fff94ca457a0cb17954e59c4a16416603ccd (diff)
Remove logging no longer needed as we have metrics.
-rw-r--r--configd/src/apps/sentinel/metrics.cpp30
-rw-r--r--configd/src/apps/sentinel/metrics.h6
-rw-r--r--configd/src/apps/sentinel/service.cpp1
3 files changed, 4 insertions, 33 deletions
diff --git a/configd/src/apps/sentinel/metrics.cpp b/configd/src/apps/sentinel/metrics.cpp
index df1b0076001..812ab56cd15 100644
--- a/configd/src/apps/sentinel/metrics.cpp
+++ b/configd/src/apps/sentinel/metrics.cpp
@@ -1,13 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "metrics.h"
-#include <vespa/log/log.h>
-LOG_SETUP(".metrics");
-
#include <vespa/vespalib/metrics/simple_metrics.h>
-namespace config {
-namespace sentinel {
+namespace config::sentinel {
using vespalib::metrics::SimpleMetricsManager;
using vespalib::metrics::SimpleManagerConfig;
@@ -17,9 +13,7 @@ StartMetrics::StartMetrics()
producer(metrics),
currentlyRunningServices(0),
totalRestartsCounter(0),
- totalRestartsLastPeriod(1),
startedTime(time(nullptr)),
- lastLoggedTime(startedTime - 55),
sentinel_restarts(metrics->counter("sentinel.restarts",
"how many times sentinel restarted a service")),
sentinel_totalRestarts(metrics->gauge("sentinel.totalRestarts",
@@ -33,20 +27,7 @@ StartMetrics::StartMetrics()
sentinel_restarts.add();
}
-void
-StartMetrics::output()
-{
- EV_VALUE("currently_running_services", currentlyRunningServices);
- EV_VALUE("total_restarts_last_period", totalRestartsLastPeriod);
- EV_COUNT("total_restarts_counter", totalRestartsCounter);
-}
-
-void
-StartMetrics::reset(unsigned long curTime)
-{
- totalRestartsLastPeriod = 0;
- lastLoggedTime = curTime;
-}
+StartMetrics::~StartMetrics() = default;
void
StartMetrics::maybeLog()
@@ -55,11 +36,6 @@ StartMetrics::maybeLog()
sentinel_totalRestarts.sample(totalRestartsCounter);
sentinel_running.sample(currentlyRunningServices);
sentinel_uptime.sample(curTime - startedTime);
- if (curTime > lastLoggedTime + 59) {
- output();
- reset(curTime);
- }
}
-} // end namespace config::sentinel
-} // end namespace config
+}
diff --git a/configd/src/apps/sentinel/metrics.h b/configd/src/apps/sentinel/metrics.h
index 2378a055663..2263d70fb60 100644
--- a/configd/src/apps/sentinel/metrics.h
+++ b/configd/src/apps/sentinel/metrics.h
@@ -15,19 +15,15 @@ struct StartMetrics {
vespalib::metrics::Producer producer;
unsigned long currentlyRunningServices;
unsigned long totalRestartsCounter;
- unsigned long totalRestartsLastPeriod;
long startedTime;
- long lastLoggedTime;
Counter sentinel_restarts;
Gauge sentinel_totalRestarts;
Gauge sentinel_running;
Gauge sentinel_uptime;
StartMetrics();
- ~StartMetrics() {}
+ ~StartMetrics();
- void output();
- void reset(unsigned long curTime);
void maybeLog();
};
diff --git a/configd/src/apps/sentinel/service.cpp b/configd/src/apps/sentinel/service.cpp
index e38328975dc..866171bf75f 100644
--- a/configd/src/apps/sentinel/service.cpp
+++ b/configd/src/apps/sentinel/service.cpp
@@ -336,7 +336,6 @@ Service::youExited(int status)
LOG(debug, "%s: Has autorestart flag, restarting.", name().c_str());
setState(READY);
_metrics.totalRestartsCounter++;
- _metrics.totalRestartsLastPeriod++;
_metrics.sentinel_restarts.add();
start();
}