summaryrefslogtreecommitdiffstats
path: root/metrics/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-01 06:51:54 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-03-01 17:02:23 +0000
commit92d9f209733942dfb20db236712b88ecd3762091 (patch)
treeaf8547900e88124e813ed872451e167675fcd099 /metrics/src
parentf2e5ba70fcacd7dfc6d5688479e220c975d26f58 (diff)
Always run the snapshot hooks when forcing a metrics update.
Diffstat (limited to 'metrics/src')
-rw-r--r--metrics/src/tests/metricmanagertest.cpp2
-rw-r--r--metrics/src/vespa/metrics/metricmanager.cpp10
-rw-r--r--metrics/src/vespa/metrics/metricmanager.h5
-rw-r--r--metrics/src/vespa/metrics/state_api_adapter.cpp2
4 files changed, 6 insertions, 13 deletions
diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp
index 6674da98452..bee4ad350c9 100644
--- a/metrics/src/tests/metricmanagertest.cpp
+++ b/metrics/src/tests/metricmanagertest.cpp
@@ -1030,7 +1030,7 @@ TEST_F(MetricManagerTest, test_update_hooks)
waitForTimeProcessed(mm, 1204);
// Give all hooks an update
- mm.updateMetrics(true);
+ mm.updateMetrics();
// Last update should not have interfered with periods
timer.set_time(1205);
diff --git a/metrics/src/vespa/metrics/metricmanager.cpp b/metrics/src/vespa/metrics/metricmanager.cpp
index 0102d98e9c7..ff0b051990f 100644
--- a/metrics/src/vespa/metrics/metricmanager.cpp
+++ b/metrics/src/vespa/metrics/metricmanager.cpp
@@ -635,17 +635,13 @@ MetricManager::timeChangedNotification() const
}
void
-MetricManager::updateMetrics(bool includeSnapshotOnlyHooks)
+MetricManager::updateMetrics()
{
- LOG(debug, "Calling metric update hooks%s.", includeSnapshotOnlyHooks ? ", including snapshot hooks" : "");
// Ensure we're not in the way of the background thread
MetricLockGuard sync(_waiter);
- LOG(debug, "Giving %zu periodic update hooks.", _periodicUpdateHooks.size());
+ LOG(debug, "Calling %zu periodic update hooks.", _periodicUpdateHooks.size());
updatePeriodicMetrics(sync, time_point(), true);
- if (includeSnapshotOnlyHooks) {
- LOG(debug, "Giving %zu snapshot update hooks.", _snapshotUpdateHooks.size());
- updateSnapshotMetrics(sync);
- }
+ updateSnapshotMetrics(sync);
}
// When this is called, the thread monitor lock has already been grabbed
diff --git a/metrics/src/vespa/metrics/metricmanager.h b/metrics/src/vespa/metrics/metricmanager.h
index a53bad72641..70c93f6be2b 100644
--- a/metrics/src/vespa/metrics/metricmanager.h
+++ b/metrics/src/vespa/metrics/metricmanager.h
@@ -155,10 +155,7 @@ public:
* nice values before reporting something.
* This function can not be called from an update hook callback.
*/
- void updateMetrics(bool includeSnapshotOnlyHooks);
- void updateMetrics() {
- updateMetrics(false);
- }
+ void updateMetrics();
/**
* Force event logging to happen now.
diff --git a/metrics/src/vespa/metrics/state_api_adapter.cpp b/metrics/src/vespa/metrics/state_api_adapter.cpp
index 793267bfbf4..61de02d3b71 100644
--- a/metrics/src/vespa/metrics/state_api_adapter.cpp
+++ b/metrics/src/vespa/metrics/state_api_adapter.cpp
@@ -26,7 +26,7 @@ StateApiAdapter::getMetrics(const vespalib::string &consumer)
vespalib::string
StateApiAdapter::getTotalMetrics(const vespalib::string &consumer)
{
- _manager.updateMetrics(true);
+ _manager.updateMetrics();
metrics::MetricLockGuard guard(_manager.getMetricLock());
_manager.checkMetricsAltered(guard);
system_time currentTime = vespalib::system_clock::now();