aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-11-26 11:15:00 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-11-26 23:08:20 +0000
commitc7721d45b452e3f29f24373c57e0b17507ae16d3 (patch)
treea9b6a4a6d801a414629b24bda0a16790db06d28f /storage
parent2944de2c274959a864c77e639d32ff87839cb21f (diff)
Remove loadmetrics indirection.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/tests/common/metricstest.cpp55
-rw-r--r--storage/src/tests/distributor/bucketdbmetricupdatertest.cpp17
-rw-r--r--storage/src/tests/distributor/externaloperationhandlertest.cpp18
-rw-r--r--storage/src/tests/distributor/getoperationtest.cpp5
-rw-r--r--storage/src/tests/distributor/putoperationtest.cpp2
-rw-r--r--storage/src/tests/distributor/removelocationtest.cpp2
-rw-r--r--storage/src/tests/distributor/removeoperationtest.cpp2
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp12
-rw-r--r--storage/src/tests/distributor/updateoperationtest.cpp14
-rw-r--r--storage/src/tests/distributor/visitoroperationtest.cpp17
-rw-r--r--storage/src/tests/persistence/filestorage/filestormanagertest.cpp14
-rw-r--r--storage/src/tests/persistence/persistencequeuetest.cpp5
-rw-r--r--storage/src/tests/persistence/persistencetestutils.cpp4
-rw-r--r--storage/src/tests/persistence/splitbitdetectortest.cpp1
-rw-r--r--storage/src/tests/storageserver/statereportertest.cpp9
-rw-r--r--storage/src/tests/visiting/visitortest.cpp3
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h2
-rw-r--r--storage/src/vespa/storage/common/statusmetricconsumer.h10
-rw-r--r--storage/src/vespa/storage/distributor/distributor.cpp14
-rw-r--r--storage/src/vespa/storage/distributor/distributormetricsset.cpp30
-rw-r--r--storage/src/vespa/storage/distributor/distributormetricsset.h26
-rw-r--r--storage/src/vespa/storage/distributor/externaloperationhandler.cpp25
-rw-r--r--storage/src/vespa/storage/distributor/idealstatemetricsset.h4
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp8
-rw-r--r--storage/src/vespa/storage/distributor/persistence_operation_metric_set.h6
-rw-r--r--storage/src/vespa/storage/distributor/update_metric_set.cpp7
-rw-r--r--storage/src/vespa/storage/distributor/update_metric_set.h2
-rw-r--r--storage/src/vespa/storage/distributor/visitormetricsset.cpp9
-rw-r--r--storage/src/vespa/storage/distributor/visitormetricsset.h2
-rw-r--r--storage/src/vespa/storage/persistence/asynchandler.cpp6
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h2
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp5
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.h2
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp51
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormetrics.h30
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.cpp1
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.h4
-rw-r--r--storage/src/vespa/storage/persistence/processallhandler.cpp4
-rw-r--r--storage/src/vespa/storage/persistence/simplemessagehandler.cpp9
-rw-r--r--storage/src/vespa/storage/storageserver/bouncer_metrics.h3
-rw-r--r--storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp6
-rw-r--r--storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h4
-rw-r--r--storage/src/vespa/storage/storageserver/communicationmanagermetrics.h4
-rw-r--r--storage/src/vespa/storage/storageserver/fnet_metrics_wrapper.h4
-rw-r--r--storage/src/vespa/storage/storageserver/mergethrottler.cpp9
-rw-r--r--storage/src/vespa/storage/storageserver/mergethrottler.h8
-rw-r--r--storage/src/vespa/storage/storageserver/statereporter.h1
-rw-r--r--storage/src/vespa/storage/storageserver/storagemetricsset.h1
-rw-r--r--storage/src/vespa/storage/storageserver/storagenode.cpp8
-rw-r--r--storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.h3
-rw-r--r--storage/src/vespa/storage/visiting/CMakeLists.txt1
-rw-r--r--storage/src/vespa/storage/visiting/visitor.cpp25
-rw-r--r--storage/src/vespa/storage/visiting/visitormanager.cpp12
-rw-r--r--storage/src/vespa/storage/visiting/visitormetrics.cpp6
-rw-r--r--storage/src/vespa/storage/visiting/visitormetrics.h16
-rw-r--r--storage/src/vespa/storage/visiting/visitorthread.cpp26
-rw-r--r--storage/src/vespa/storage/visiting/visitorthread.h3
-rw-r--r--storage/src/vespa/storage/visiting/visitorthreadmetrics.cpp27
-rw-r--r--storage/src/vespa/storage/visiting/visitorthreadmetrics.h116
59 files changed, 306 insertions, 416 deletions
diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp
index fa46fce5e93..2c09b2974e5 100644
--- a/storage/src/tests/common/metricstest.cpp
+++ b/storage/src/tests/common/metricstest.cpp
@@ -5,6 +5,7 @@
#include <vespa/storage/bucketdb/bucketmanager.h>
#include <vespa/storage/common/statusmetricconsumer.h>
#include <vespa/storage/persistence/filestorage/filestormanager.h>
+#include <vespa/storage/persistence/filestorage/filestormetrics.h>
#include <vespa/storage/visiting/visitormetrics.h>
#include <tests/common/teststorageapp.h>
#include <tests/common/testhelper.h>
@@ -94,15 +95,15 @@ void MetricsTest::SetUp() {
documentapi::LoadTypeSet::SP loadTypes(_node->getLoadTypes());
- _filestorMetrics = std::make_shared<FileStorMetrics>(_node->getLoadTypes()->getMetricLoadTypes());
- _filestorMetrics->initDiskMetrics(loadTypes->getMetricLoadTypes(), 1, 1);
+ _filestorMetrics = std::make_shared<FileStorMetrics>();
+ _filestorMetrics->initDiskMetrics(1, 1);
_topSet->registerMetric(*_filestorMetrics);
_bucketManagerMetrics = std::make_shared<BucketManagerMetrics>(_node->getComponentRegister().getBucketSpaceRepo());
_topSet->registerMetric(*_bucketManagerMetrics);
_visitorMetrics = std::make_shared<VisitorMetrics>();
- _visitorMetrics->initThreads(4, loadTypes->getMetricLoadTypes());
+ _visitorMetrics->initThreads(4);
_topSet->registerMetric(*_visitorMetrics);
_metricManager->init(_config->getConfigId(), _node->getThreadPool());
}
@@ -145,22 +146,22 @@ void MetricsTest::createFakeLoad()
using documentapi::LoadType;
- thread.put[LoadType::DEFAULT].count.inc(10 * n);
- thread.put[LoadType::DEFAULT].latency.addValue(5 * n);
- thread.get[LoadType::DEFAULT].count.inc(12 * n);
- thread.get[LoadType::DEFAULT].notFound.inc(2 * n);
- thread.get[LoadType::DEFAULT].latency.addValue(3 * n);
- thread.remove[LoadType::DEFAULT].count.inc(6 * n);
- thread.remove[LoadType::DEFAULT].notFound.inc(1 * n);
- thread.remove[LoadType::DEFAULT].latency.addValue(2 * n);
- thread.update[LoadType::DEFAULT].count.inc(2 * n);
- thread.update[LoadType::DEFAULT].notFound.inc(1 * n);
- thread.update[LoadType::DEFAULT].latencyRead.addValue(2 * n);
- thread.update[LoadType::DEFAULT].latency.addValue(7 * n);
- thread.revert[LoadType::DEFAULT].count.inc(2 * n);
- thread.revert[LoadType::DEFAULT].notFound.inc(n / 2);
- thread.revert[LoadType::DEFAULT].latency.addValue(2 * n);
- thread.visit[LoadType::DEFAULT].count.inc(6 * n);
+ thread.put.count.inc(10 * n);
+ thread.put.latency.addValue(5 * n);
+ thread.get.count.inc(12 * n);
+ thread.get.notFound.inc(2 * n);
+ thread.get.latency.addValue(3 * n);
+ thread.remove.count.inc(6 * n);
+ thread.remove.notFound.inc(1 * n);
+ thread.remove.latency.addValue(2 * n);
+ thread.update.count.inc(2 * n);
+ thread.update.notFound.inc(1 * n);
+ thread.update.latencyRead.addValue(2 * n);
+ thread.update.latency.addValue(7 * n);
+ thread.revert.count.inc(2 * n);
+ thread.revert.notFound.inc(n / 2);
+ thread.revert.latency.addValue(2 * n);
+ thread.visit.count.inc(6 * n);
thread.deleteBuckets.count.inc(1 * n);
thread.repairs.count.inc(3 * n);
@@ -186,12 +187,12 @@ void MetricsTest::createFakeLoad()
for (uint32_t i=0; i<_visitorMetrics->threads.size(); ++i) {
VisitorThreadMetrics& thread(*_visitorMetrics->threads[i]);
thread.queueSize.addValue(2);
- thread.averageQueueWaitingTime[documentapi::LoadType::DEFAULT].addValue(10);
- thread.averageVisitorLifeTime[documentapi::LoadType::DEFAULT].addValue(1000);
- thread.createdVisitors[documentapi::LoadType::DEFAULT].inc(5 * n);
- thread.abortedVisitors[documentapi::LoadType::DEFAULT].inc(1 * n);
- thread.completedVisitors[documentapi::LoadType::DEFAULT].inc(4 * n);
- thread.failedVisitors[documentapi::LoadType::DEFAULT].inc(2 * n);
+ thread.averageQueueWaitingTime.addValue(10);
+ thread.averageVisitorLifeTime.addValue(1000);
+ thread.createdVisitors.inc(5 * n);
+ thread.abortedVisitors.inc(1 * n);
+ thread.completedVisitors.inc(4 * n);
+ thread.failedVisitors.inc(2 * n);
}
_clock->addSecondsToTime(60);
_metricManager->timeChangedNotification();
@@ -242,7 +243,7 @@ TEST_F(MetricsTest, snapshot_presenting) {
LOG(debug, "Adding to get metric");
using documentapi::LoadType;
- thread0.get[LoadType::DEFAULT].count.inc(1);
+ thread0.get.count.inc(1);
LOG(debug, "Waiting for 5 minute snapshot to be taken");
// Wait until active metrics have been added to 5 min snapshot and reset
@@ -258,7 +259,7 @@ TEST_F(MetricsTest, snapshot_presenting) {
}
LOG(debug, "5 minute snapshot should have been taken. Adding put count");
- thread0.put[LoadType::DEFAULT].count.inc(1);
+ thread0.put.count.inc(1);
// Verify that active metrics have set put count but not get count
ASSERT_METRIC(-2, "vds.filestor.alldisks.allthreads.put.sum.count", 1);
diff --git a/storage/src/tests/distributor/bucketdbmetricupdatertest.cpp b/storage/src/tests/distributor/bucketdbmetricupdatertest.cpp
index e0c3cf161bb..6b8a6608c34 100644
--- a/storage/src/tests/distributor/bucketdbmetricupdatertest.cpp
+++ b/storage/src/tests/distributor/bucketdbmetricupdatertest.cpp
@@ -23,14 +23,11 @@ struct BucketDBMetricUpdaterTest : Test {
using NodeToReplicasMap = std::unordered_map<uint16_t, uint32_t>;
NodeToReplicasMap replicaStatsOf(BucketDBMetricUpdater& metricUpdater);
- metrics::LoadTypeSet _loadTypes;
-
BucketDBMetricUpdaterTest();
};
BucketDBMetricUpdaterTest::BucketDBMetricUpdaterTest()
{
- _loadTypes.push_back(metrics::LoadType(0, "foo"));
}
namespace {
@@ -65,7 +62,7 @@ makeInfo(uint32_t copy0Crc, uint32_t copy1Crc)
TEST_F(BucketDBMetricUpdaterTest, doc_and_byte_counts_are_updated) {
BucketDBMetricUpdater metricUpdater;
IdealStateMetricSet ims;
- DistributorMetricSet dms(_loadTypes);
+ DistributorMetricSet dms;
EXPECT_FALSE(metricUpdater.hasCompletedRound());
@@ -104,7 +101,7 @@ TEST_F(BucketDBMetricUpdaterTest, doc_and_byte_counts_are_updated) {
TEST_F(BucketDBMetricUpdaterTest, bucket_db_memory_usage_metrics_are_updated) {
BucketDBMetricUpdater metric_updater;
IdealStateMetricSet ims;
- DistributorMetricSet dms(_loadTypes);
+ DistributorMetricSet dms;
vespalib::MemoryUsage mem_usage;
mem_usage.incAllocatedBytes(1000);
@@ -138,7 +135,7 @@ TEST_F(BucketDBMetricUpdaterTest, bucket_db_memory_usage_metrics_are_updated) {
TEST_F(BucketDBMetricUpdaterTest, buckets_with_too_few_and_too_many_copies) {
BucketDBMetricUpdater metricUpdater;
IdealStateMetricSet ims;
- DistributorMetricSet dms(_loadTypes);
+ DistributorMetricSet dms;
metricUpdater.completeRound();
metricUpdater.getLastCompleteStats().propagateMetrics(ims, dms);
@@ -186,7 +183,7 @@ TEST_F(BucketDBMetricUpdaterTest, buckets_with_too_few_and_too_many_copies) {
TEST_F(BucketDBMetricUpdaterTest, buckets_with_varying_trustedness) {
BucketDBMetricUpdater metricUpdater;
IdealStateMetricSet ims;
- DistributorMetricSet dms(_loadTypes);
+ DistributorMetricSet dms;
metricUpdater.completeRound(false);
metricUpdater.getLastCompleteStats().propagateMetrics(ims, dms);
@@ -222,7 +219,7 @@ TEST_F(BucketDBMetricUpdaterTest, buckets_with_varying_trustedness) {
TEST_F(BucketDBMetricUpdaterTest, pick_counts_from_trusted_copy) {
BucketDBMetricUpdater metricUpdater;
IdealStateMetricSet ims;
- DistributorMetricSet dms(_loadTypes);
+ DistributorMetricSet dms;
// First copy added is implicitly trusted, but it is not the largest.
BucketDatabase::Entry e(document::BucketId(16, 2), makeInfo(100, 200));
@@ -237,7 +234,7 @@ TEST_F(BucketDBMetricUpdaterTest, pick_counts_from_trusted_copy) {
TEST_F(BucketDBMetricUpdaterTest, pick_largest_copy_if_no_trusted) {
BucketDBMetricUpdater metricUpdater;
IdealStateMetricSet ims;
- DistributorMetricSet dms(_loadTypes);
+ DistributorMetricSet dms;
// No trusted copies, so must pick second copy.
BucketInfo info(makeInfo(100, 200));
@@ -254,7 +251,7 @@ TEST_F(BucketDBMetricUpdaterTest, pick_largest_copy_if_no_trusted) {
TEST_F(BucketDBMetricUpdaterTest, complete_round_clears_working_state) {
BucketDBMetricUpdater metricUpdater;
IdealStateMetricSet ims;
- DistributorMetricSet dms(_loadTypes);
+ DistributorMetricSet dms;
{
BucketDatabase::Entry e(document::BucketId(16, 1), makeInfo(10));
diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp
index 1f0fba90200..9bd64876e98 100644
--- a/storage/src/tests/distributor/externaloperationhandlertest.cpp
+++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp
@@ -43,23 +43,21 @@ struct ExternalOperationHandlerTest : Test, DistributorTestUtil {
void start_operation_verify_rejected(std::shared_ptr<api::StorageCommand> cmd);
int64_t safe_time_not_reached_metric_count(
- const metrics::LoadMetric<PersistenceOperationMetricSet>& metrics) const {
- return metrics[documentapi::LoadType::DEFAULT].failures
- .safe_time_not_reached.getLongValue("count");
+ const PersistenceOperationMetricSet & metrics) const {
+ return metrics.failures.safe_time_not_reached.getLongValue("count");
}
- int64_t safe_time_not_reached_metric_count(const metrics::LoadMetric<UpdateMetricSet>& metrics) const {
- return metrics[documentapi::LoadType::DEFAULT].failures.safe_time_not_reached.getLongValue("count");
+ int64_t safe_time_not_reached_metric_count(const UpdateMetricSet & metrics) const {
+ return metrics.failures.safe_time_not_reached.getLongValue("count");
}
int64_t concurrent_mutatations_metric_count(
- const metrics::LoadMetric<PersistenceOperationMetricSet>& metrics) const {
- return metrics[documentapi::LoadType::DEFAULT].failures
- .concurrent_mutations.getLongValue("count");
+ const PersistenceOperationMetricSet& metrics) const {
+ return metrics.failures.concurrent_mutations.getLongValue("count");
}
- int64_t concurrent_mutatations_metric_count(const metrics::LoadMetric<UpdateMetricSet>& metrics) const {
- return metrics[documentapi::LoadType::DEFAULT].failures.concurrent_mutations.getLongValue("count");
+ int64_t concurrent_mutatations_metric_count(const UpdateMetricSet & metrics) const {
+ return metrics.failures.concurrent_mutations.getLongValue("count");
}
void set_up_distributor_for_sequencing_test();
diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp
index 09e4f41d275..410705bb1a0 100644
--- a/storage/src/tests/distributor/getoperationtest.cpp
+++ b/storage/src/tests/distributor/getoperationtest.cpp
@@ -58,7 +58,7 @@ struct GetOperationTest : Test, DistributorTestUtil {
op = std::make_unique<GetOperation>(
getExternalOperationHandler(), getDistributorBucketSpace(),
getDistributorBucketSpace().getBucketDatabase().acquire_read_guard(),
- msg, getDistributor().getMetrics(). gets[msg->getLoadType()],
+ msg, getDistributor().getMetrics().gets,
consistency);
op->start(_sender, framework::MilliSecTime(0));
}
@@ -414,8 +414,7 @@ TEST_F(GetOperationTest, not_found) {
"timestamp 0) ReturnCode(NONE)",
_sender.getLastReply());
- EXPECT_EQ(1, getDistributor().getMetrics().gets[documentapi::LoadType::DEFAULT].
- failures.notfound.getValue());
+ EXPECT_EQ(1, getDistributor().getMetrics().gets.failures.notfound.getValue());
EXPECT_FALSE(op->any_replicas_failed()); // "Not found" is not a failure.
EXPECT_TRUE(last_reply_had_consistent_replicas());
EXPECT_TRUE(op->newest_replica().has_value());
diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp
index 16d5dcf3b25..a69948e6dd7 100644
--- a/storage/src/tests/distributor/putoperationtest.cpp
+++ b/storage/src/tests/distributor/putoperationtest.cpp
@@ -76,7 +76,7 @@ public:
getDistributorBucketSpace(),
msg,
getDistributor().getMetrics().
- puts[msg->getLoadType()]);
+ puts);
op->start(_sender, framework::MilliSecTime(0));
}
diff --git a/storage/src/tests/distributor/removelocationtest.cpp b/storage/src/tests/distributor/removelocationtest.cpp
index 74daba3d098..9874e936e62 100644
--- a/storage/src/tests/distributor/removelocationtest.cpp
+++ b/storage/src/tests/distributor/removelocationtest.cpp
@@ -31,7 +31,7 @@ struct RemoveLocationOperationTest : Test, DistributorTestUtil {
getDistributorBucketSpace(),
msg,
getDistributor().getMetrics().
- removelocations[msg->getLoadType()]);
+ removelocations);
op->start(_sender, framework::MilliSecTime(0));
}
diff --git a/storage/src/tests/distributor/removeoperationtest.cpp b/storage/src/tests/distributor/removeoperationtest.cpp
index c3fcda30bf5..02c2771a78c 100644
--- a/storage/src/tests/distributor/removeoperationtest.cpp
+++ b/storage/src/tests/distributor/removeoperationtest.cpp
@@ -39,7 +39,7 @@ struct RemoveOperationTest : Test, DistributorTestUtil {
getDistributorBucketSpace(),
msg,
getDistributor().getMetrics().
- removes[msg->getLoadType()]);
+ removes);
op->start(_sender, framework::MilliSecTime(0));
}
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index 635e5b9883b..200a98e352f 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -1002,7 +1002,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_consistent_get_reply_timestamps_re
"ReturnCode(NONE)",
_sender.getLastReply(true));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(1, metrics.fast_path_restarts.getValue());
}
@@ -1021,7 +1021,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_consistent_get_reply_timestamps_do
// Should _not_ be restarted with fast path, as it has been config disabled
ASSERT_EQ("Put => 1,Put => 0", _sender.getCommands(true, false, 2));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(0, metrics.fast_path_restarts.getValue());
}
@@ -1116,7 +1116,7 @@ TEST_F(ThreePhaseUpdateTest, full_document_get_sent_to_replica_with_highest_time
reply_to_metadata_get(*cb, _sender, 0, 1000U);
reply_to_metadata_get(*cb, _sender, 1, 2000U);
- auto& metrics = getDistributor().getMetrics().update_metadata_gets[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().update_metadata_gets;
EXPECT_EQ(1, metrics.ok.getValue()); // Technically tracks an entire operation covering multiple Gets.
// Node 1 has newest document version at ts=2000
@@ -1137,7 +1137,7 @@ TEST_F(ThreePhaseUpdateTest, puts_are_sent_after_receiving_full_document_get) {
replyToGet(*cb, _sender, 2, 2000U);
ASSERT_EQ("Put => 1,Put => 0", _sender.getCommands(true, false, 3));
- auto& metrics = getDistributor().getMetrics().update_gets[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().update_gets;
EXPECT_EQ(1, metrics.ok.getValue());
}
@@ -1158,7 +1158,7 @@ TEST_F(ThreePhaseUpdateTest, consistent_meta_get_timestamps_can_restart_in_fast_
"ReturnCode(NONE)",
_sender.getLastReply(true));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(1, metrics.fast_path_restarts.getValue());
}
@@ -1178,7 +1178,7 @@ TEST_F(ThreePhaseUpdateTest, no_document_found_on_any_replicas_is_considered_con
reply_to_metadata_get(*cb, _sender, 1, no_document_timestamp);
ASSERT_EQ("Update => 0,Update => 1", _sender.getCommands(true, false, 2));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(1, metrics.fast_path_restarts.getValue());
}
diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp
index 844cf80e6b6..422baf08465 100644
--- a/storage/src/tests/distributor/updateoperationtest.cpp
+++ b/storage/src/tests/distributor/updateoperationtest.cpp
@@ -68,7 +68,7 @@ UpdateOperationTest::sendUpdate(const std::string& bucketState, bool create_if_m
ExternalOperationHandler& handler = getExternalOperationHandler();
return std::make_shared<UpdateOperation>(
handler, getDistributorBucketSpace(), msg,
- getDistributor().getMetrics().updates[msg->getLoadType()]);
+ getDistributor().getMetrics().updates);
}
void
@@ -101,7 +101,7 @@ TEST_F(UpdateOperationTest, simple) {
"timestamp 100, timestamp of updated doc: 90) ReturnCode(NONE)",
sender.getLastReply(true));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(0, metrics.diverging_timestamp_updates.getValue());
}
@@ -141,7 +141,7 @@ TEST_F(UpdateOperationTest, multi_node) {
"node(idx=0,crc=0x2,docs=4/4,bytes=6/6,trusted=true,active=false,ready=false)",
dumpBucket(_bId));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(0, metrics.diverging_timestamp_updates.getValue());
}
@@ -161,7 +161,7 @@ TEST_F(UpdateOperationTest, multi_node_inconsistent_timestamp) {
"(best node 1)) ReturnCode(NONE)",
sender.getLastReply(true));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(1, metrics.diverging_timestamp_updates.getValue());
}
@@ -179,7 +179,7 @@ TEST_F(UpdateOperationTest, test_and_set_failures_increment_tas_metric) {
"ReturnCode(TEST_AND_SET_CONDITION_FAILED, bork bork)",
sender.getLastReply(true));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(1, metrics.failures.test_and_set_failed.getValue());
}
@@ -212,7 +212,7 @@ TEST_F(UpdateOperationTest, create_if_missing_update_sentinel_timestamp_is_treat
"timestamp 100, timestamp of updated doc: 0) ReturnCode(NONE)",
sender.getLastReply(true));
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
EXPECT_EQ(0, metrics.diverging_timestamp_updates.getValue());
}
@@ -236,7 +236,7 @@ TEST_F(UpdateOperationTest, inconsistent_create_if_missing_updates_picks_largest
EXPECT_NE(newest.first, BucketId());
EXPECT_EQ(newest.second, 1);
- auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT];
+ auto& metrics = getDistributor().getMetrics().updates;
// Implementation detail: since we get diverging results from nodes 2 and 1, these are
// counted as separate diverging updates.
EXPECT_EQ(2, metrics.diverging_timestamp_updates.getValue());
diff --git a/storage/src/tests/distributor/visitoroperationtest.cpp b/storage/src/tests/distributor/visitoroperationtest.cpp
index 8a9d8063525..df5180bbb7c 100644
--- a/storage/src/tests/distributor/visitoroperationtest.cpp
+++ b/storage/src/tests/distributor/visitoroperationtest.cpp
@@ -94,7 +94,7 @@ struct VisitorOperationTest : Test, DistributorTestUtil {
}
VisitorMetricSet& defaultVisitorMetrics() {
- return getDistributor().getMetrics().visits[documentapi::LoadType::DEFAULT];
+ return getDistributor().getMetrics().visits;
}
std::unique_ptr<VisitorOperation> createOpWithConfig(
@@ -106,11 +106,10 @@ struct VisitorOperationTest : Test, DistributorTestUtil {
getDistributorBucketSpace(),
msg,
config,
- getDistributor().getMetrics().visits[msg->getLoadType()]);
+ getDistributor().getMetrics().visits);
}
- std::unique_ptr<VisitorOperation> createOpWithDefaultConfig(
- api::CreateVisitorCommand::SP msg)
+ std::unique_ptr<VisitorOperation> createOpWithDefaultConfig(api::CreateVisitorCommand::SP msg)
{
return createOpWithConfig(std::move(msg), defaultConfig);
}
@@ -126,21 +125,17 @@ struct VisitorOperationTest : Test, DistributorTestUtil {
}
const std::vector<BucketId>& getBucketsFromLastCommand() {
- const auto& cvc = dynamic_cast<const CreateVisitorCommand&>(
- *_sender.commands().back());
+ const auto& cvc = dynamic_cast<const CreateVisitorCommand&>(*_sender.commands().back());
return cvc.getBuckets();
}
std::pair<std::string, std::string>
- runVisitor(document::BucketId id,
- document::BucketId lastId,
- uint32_t maxBuckets);
+ runVisitor(document::BucketId id, document::BucketId lastId, uint32_t maxBuckets);
void doStandardVisitTest(const std::string& clusterState);
- std::unique_ptr<VisitorOperation> startOperationWith2StorageNodeVisitors(
- bool inconsistent);
+ std::unique_ptr<VisitorOperation> startOperationWith2StorageNodeVisitors(bool inconsistent);
void do_visitor_roundtrip_with_statistics(const api::ReturnCode& result);
};
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
index 39bbfa21e4e..6a888e6c02d 100644
--- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
+++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
@@ -264,13 +264,13 @@ struct FileStorHandlerComponents {
dummyManager(new DummyStorageLink),
messageSender(*dummyManager),
loadTypes("raw:"),
- metrics(loadTypes.getMetricLoadTypes()),
+ metrics(),
filestorHandler()
{
top.push_back(std::unique_ptr<StorageLink>(dummyManager));
top.open();
- metrics.initDiskMetrics(loadTypes.getMetricLoadTypes(), 1, threadsPerDisk);
+ metrics.initDiskMetrics(1, threadsPerDisk);
filestorHandler = std::make_unique<FileStorHandlerImpl>(messageSender, metrics, test._node->getComponentRegister());
filestorHandler->setGetNextMessageTimeout(50ms);
@@ -1831,7 +1831,7 @@ TEST_F(FileStorManagerTest, put_command_size_is_added_to_metric) {
auto cmd = std::make_shared<api::PutCommand>(
makeDocumentBucket(bucket), _node->getTestDocMan().createRandomDocument(), api::Timestamp(12345));
- assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->put[defaultLoadType]);
+ assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->put);
}
TEST_F(FileStorManagerTest, update_command_size_is_added_to_metric) {
@@ -1845,7 +1845,7 @@ TEST_F(FileStorManagerTest, update_command_size_is_added_to_metric) {
auto cmd = std::make_shared<api::UpdateCommand>(
makeDocumentBucket(bucket), std::move(update), api::Timestamp(123456));
- assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->update[defaultLoadType]);
+ assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->update);
}
TEST_F(FileStorManagerTest, remove_command_size_is_added_to_metric) {
@@ -1855,7 +1855,7 @@ TEST_F(FileStorManagerTest, remove_command_size_is_added_to_metric) {
auto cmd = std::make_shared<api::RemoveCommand>(
makeDocumentBucket(bucket), document::DocumentId("id:foo:testdoctype1::bar"), api::Timestamp(123456));
- assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->remove[defaultLoadType]);
+ assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->remove);
}
TEST_F(FileStorManagerTest, get_command_size_is_added_to_metric) {
@@ -1865,7 +1865,7 @@ TEST_F(FileStorManagerTest, get_command_size_is_added_to_metric) {
auto cmd = std::make_shared<api::GetCommand>(
makeDocumentBucket(bucket), document::DocumentId("id:foo:testdoctype1::bar"), document::AllFields::NAME);
- assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->get[defaultLoadType]);
+ assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->get);
}
TEST_F(FileStorManagerTest, test_and_set_condition_mismatch_not_counted_as_failure) {
@@ -1882,7 +1882,7 @@ TEST_F(FileStorManagerTest, test_and_set_condition_mismatch_not_counted_as_failu
ASSERT_SINGLE_REPLY(api::PutReply, reply, c.top, _waitTime);
EXPECT_EQ(reply->getResult().getResult(), api::ReturnCode::TEST_AND_SET_CONDITION_FAILED);
- auto& metrics = thread_metrics_of(*c.manager)->put[defaultLoadType];
+ auto& metrics = thread_metrics_of(*c.manager)->put;
EXPECT_EQ(metrics.failed.getValue(), 0);
EXPECT_EQ(metrics.test_and_set_failed.getValue(), 1);
EXPECT_EQ(thread_metrics_of(*c.manager)->failedOperations.getValue(), 0);
diff --git a/storage/src/tests/persistence/persistencequeuetest.cpp b/storage/src/tests/persistence/persistencequeuetest.cpp
index 61c6e446517..62ba8bd876d 100644
--- a/storage/src/tests/persistence/persistencequeuetest.cpp
+++ b/storage/src/tests/persistence/persistencequeuetest.cpp
@@ -3,6 +3,7 @@
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
#include <tests/persistence/filestorage/forwardingmessagesender.h>
+#include <vespa/storage/persistence/filestorage/filestormetrics.h>
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/log/log.h>
@@ -42,13 +43,13 @@ PersistenceQueueTest::Fixture::Fixture(FileStorTestFixture& parent_)
dummyManager(std::make_unique<DummyStorageLink>()),
messageSender(*dummyManager),
loadTypes("raw:"),
- metrics(loadTypes.getMetricLoadTypes()),
+ metrics(),
stripeId(0)
{
top.push_back(std::move(dummyManager));
top.open();
- metrics.initDiskMetrics(loadTypes.getMetricLoadTypes(), 1, 1);
+ metrics.initDiskMetrics(1, 1);
filestorHandler = std::make_unique<FileStorHandlerImpl>(messageSender, metrics,
parent._node->getComponentRegister());
diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp
index 278cb36b50c..9e779c5904b 100644
--- a/storage/src/tests/persistence/persistencetestutils.cpp
+++ b/storage/src/tests/persistence/persistencetestutils.cpp
@@ -52,10 +52,10 @@ PersistenceTestEnvironment::PersistenceTestEnvironment(const std::string & rootO
_messageKeeper(),
_node(NodeIndex(0), _config.getConfigId()),
_component(_node.getComponentRegister(), "persistence test env"),
- _metrics(_component.getLoadTypes()->getMetricLoadTypes())
+ _metrics()
{
_node.setupDummyPersistence();
- _metrics.initDiskMetrics(_node.getLoadTypes()->getMetricLoadTypes(), 1, 1);
+ _metrics.initDiskMetrics(1, 1);
_handler = std::make_unique<FileStorHandlerImpl>(_messageKeeper, _metrics, _node.getComponentRegister());
_diskEnv = std::make_unique<PersistenceUtil>(_component, *_handler,
*_metrics.disk->threads[0], _node.getPersistenceProvider());
diff --git a/storage/src/tests/persistence/splitbitdetectortest.cpp b/storage/src/tests/persistence/splitbitdetectortest.cpp
index 4982383685a..e1a1b6cf11b 100644
--- a/storage/src/tests/persistence/splitbitdetectortest.cpp
+++ b/storage/src/tests/persistence/splitbitdetectortest.cpp
@@ -7,7 +7,6 @@
#include <vespa/persistence/spi/test.h>
#include <vespa/document/base/testdocman.h>
#include <vespa/document/bucket/bucketidfactory.h>
-#include <vespa/metrics/loadmetric.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <algorithm>
diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp
index c67598dc37b..9a22a02941b 100644
--- a/storage/src/tests/storageserver/statereportertest.cpp
+++ b/storage/src/tests/storageserver/statereportertest.cpp
@@ -2,6 +2,7 @@
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
#include <vespa/storage/persistence/filestorage/filestormanager.h>
+#include <vespa/storage/persistence/filestorage/filestormetrics.h>
#include <vespa/storage/storageserver/applicationgenerationfetcher.h>
#include <vespa/storage/storageserver/statereporter.h>
#include <vespa/metrics/metricmanager.h>
@@ -91,8 +92,8 @@ void StateReporterTest::SetUp() {
documentapi::LoadTypeSet::SP loadTypes(_node->getLoadTypes());
- _filestorMetrics = std::make_shared<FileStorMetrics>(_node->getLoadTypes()->getMetricLoadTypes());
- _filestorMetrics->initDiskMetrics(loadTypes->getMetricLoadTypes(), 1, 1);
+ _filestorMetrics = std::make_shared<FileStorMetrics>();
+ _filestorMetrics->initDiskMetrics(1, 1);
_topSet->registerMetric(*_filestorMetrics);
_metricManager->init(_config->getConfigId(), _node->getThreadPool());
@@ -223,7 +224,7 @@ TEST_F(StateReporterTest, report_metrics) {
LOG(debug, "Adding to get metric");
using documentapi::LoadType;
- thread0.get[LoadType::DEFAULT].count.inc(1);
+ thread0.get.count.inc(1);
LOG(debug, "Waiting for 5 minute snapshot to be taken");
// Wait until active metrics have been added to 5 min snapshot and reset
@@ -239,7 +240,7 @@ TEST_F(StateReporterTest, report_metrics) {
}
LOG(debug, "5 minute snapshot should have been taken. Adding put count");
- thread0.put[LoadType::DEFAULT].count.inc(1);
+ thread0.put.count.inc(1);
const int pathCount = 2;
const char* paths[pathCount] = {
diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp
index 9d0d5575993..b362e368b9b 100644
--- a/storage/src/tests/visiting/visitortest.cpp
+++ b/storage/src/tests/visiting/visitortest.cpp
@@ -127,8 +127,7 @@ protected:
// come in and wipe our accumulated failure metrics.
// Only 1 visitor thread running, so we know it has the metrics.
const auto& metrics = _manager->getThread(0).getMetrics();
- auto loadType = documentapi::LoadType::DEFAULT;
- return metrics.visitorDestinationFailureReplies[loadType].getCount();
+ return metrics.visitorDestinationFailureReplies.getCount();
}
};
diff --git a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h
index e475252f23a..e2d8dc69f9b 100644
--- a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h
+++ b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h
@@ -3,8 +3,8 @@
#pragma once
#include <vespa/document/bucket/bucketspace.h>
-#include <vespa/metrics/metrics.h>
#include <vespa/metrics/common/memory_usage_metrics.h>
+#include <vespa/metrics/summetric.h>
#include <unordered_map>
#include <memory>
diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.h b/storage/src/vespa/storage/common/statusmetricconsumer.h
index 2c989bf1e97..8d38c72d162 100644
--- a/storage/src/vespa/storage/common/statusmetricconsumer.h
+++ b/storage/src/vespa/storage/common/statusmetricconsumer.h
@@ -13,12 +13,11 @@
#include <vespa/storageframework/generic/status/statusreporter.h>
#include <vespa/storageframework/generic/metric/metricupdatehook.h>
#include <vespa/vespalib/util/document_runnable.h>
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricmanager.h>
#include <map>
-namespace vespalib {
- class StringTokenizer;
-}
+namespace vespalib { class StringTokenizer; }
+namespace metrics { class MetricManager; }
namespace storage {
@@ -39,9 +38,6 @@ public:
bool reportStatus(std::ostream& out, const framework::HttpUrlPath&) const override;
void updateMetrics(const MetricLockGuard & guard) override;
private:
- typedef metrics::Metric Metric;
- typedef metrics::Metric::String String;
-
metrics::MetricManager& _manager;
StorageComponent _component;
std::string _name;
diff --git a/storage/src/vespa/storage/distributor/distributor.cpp b/storage/src/vespa/storage/distributor/distributor.cpp
index 525add2ede2..9c1af99100b 100644
--- a/storage/src/vespa/storage/distributor/distributor.cpp
+++ b/storage/src/vespa/storage/distributor/distributor.cpp
@@ -75,7 +75,7 @@ Distributor::Distributor(DistributorComponentRegister& compReg,
_component(compReg, "distributor"),
_bucketSpaceRepo(std::make_unique<DistributorBucketSpaceRepo>()),
_readOnlyBucketSpaceRepo(std::make_unique<DistributorBucketSpaceRepo>()),
- _metrics(new DistributorMetricSet(_component.getLoadTypes()->getMetricLoadTypes())),
+ _metrics(std::make_shared<DistributorMetricSet>()),
_operationOwner(*this, _component.getClock()),
_maintenanceOperationOwner(*this, _component.getClock()),
_pendingMessageTracker(compReg),
@@ -89,16 +89,16 @@ Distributor::Distributor(DistributorComponentRegister& compReg,
_doneInitializeHandler(doneInitHandler),
_doneInitializing(false),
_messageSender(messageSender),
- _bucketPriorityDb(new SimpleBucketPriorityDatabase()),
- _scanner(new SimpleMaintenanceScanner(*_bucketPriorityDb, _idealStateManager, *_bucketSpaceRepo)),
- _throttlingStarter(new ThrottlingOperationStarter(_maintenanceOperationOwner)),
- _blockingStarter(new BlockingOperationStarter(_pendingMessageTracker, *_throttlingStarter)),
- _scheduler(new MaintenanceScheduler(_idealStateManager, *_bucketPriorityDb, *_blockingStarter)),
+ _bucketPriorityDb(std::make_unique<SimpleBucketPriorityDatabase>()),
+ _scanner(std::make_unique<SimpleMaintenanceScanner>(*_bucketPriorityDb, _idealStateManager, *_bucketSpaceRepo)),
+ _throttlingStarter(std::make_unique<ThrottlingOperationStarter>(_maintenanceOperationOwner)),
+ _blockingStarter(std::make_unique<BlockingOperationStarter>(_pendingMessageTracker, *_throttlingStarter)),
+ _scheduler(std::make_unique<MaintenanceScheduler>(_idealStateManager, *_bucketPriorityDb, *_blockingStarter)),
_schedulingMode(MaintenanceScheduler::NORMAL_SCHEDULING_MODE),
_recoveryTimeStarted(_component.getClock()),
_tickResult(framework::ThreadWaitInfo::NO_MORE_CRITICAL_WORK_KNOWN),
_clusterName(_component.getClusterName()),
- _bucketIdHasher(new BucketGcTimeCalculator::BucketIdIdentityHasher()),
+ _bucketIdHasher(std::make_unique<BucketGcTimeCalculator::BucketIdIdentityHasher>()),
_metricUpdateHook(*this),
_metricLock(),
_maintenanceStats(),
diff --git a/storage/src/vespa/storage/distributor/distributormetricsset.cpp b/storage/src/vespa/storage/distributor/distributormetricsset.cpp
index ab4b124d71c..c95f74fd421 100644
--- a/storage/src/vespa/storage/distributor/distributormetricsset.cpp
+++ b/storage/src/vespa/storage/distributor/distributormetricsset.cpp
@@ -1,7 +1,5 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "distributormetricsset.h"
-#include <vespa/metrics/loadmetric.hpp>
-#include <vespa/metrics/summetric.hpp>
#include <vespa/vespalib/util/memoryusage.h>
namespace storage::distributor {
@@ -15,19 +13,20 @@ BucketDbMetrics::BucketDbMetrics(const vespalib::string& db_type, metrics::Metri
BucketDbMetrics::~BucketDbMetrics() = default;
-DistributorMetricSet::DistributorMetricSet(const metrics::LoadTypeSet& lt)
+//TODO Vespa 8 all metrics with .sum in the name should have that removed.
+DistributorMetricSet::DistributorMetricSet()
: MetricSet("distributor", {{"distributor"}}, ""),
- puts(lt, PersistenceOperationMetricSet("puts"), this),
- updates(lt, UpdateMetricSet(), this),
- update_puts(lt, PersistenceOperationMetricSet("update_puts"), this),
- update_gets(lt, PersistenceOperationMetricSet("update_gets"), this),
- update_metadata_gets(lt, PersistenceOperationMetricSet("update_metadata_gets"), this),
- removes(lt, PersistenceOperationMetricSet("removes"), this),
- removelocations(lt, PersistenceOperationMetricSet("removelocations"), this),
- gets(lt, PersistenceOperationMetricSet("gets"), this),
- stats(lt, PersistenceOperationMetricSet("stats"), this),
- getbucketlists(lt, PersistenceOperationMetricSet("getbucketlists"), this),
- visits(lt, VisitorMetricSet(), this),
+ puts("puts.sum", this),
+ updates(this),
+ update_puts("update_puts", this),
+ update_gets("update_gets", this),
+ update_metadata_gets("update_metadata_gets", this),
+ removes("removes.sum", this),
+ removelocations("removelocations.sum", this),
+ gets("gets.sum", this),
+ stats("stats", this),
+ getbucketlists("getbucketlists", this),
+ visits(this),
stateTransitionTime("state_transition_time", {},
"Time it takes to complete a cluster state transition. If a "
"state transition is preempted before completing, its elapsed "
@@ -57,6 +56,3 @@ DistributorMetricSet::DistributorMetricSet(const metrics::LoadTypeSet& lt)
DistributorMetricSet::~DistributorMetricSet() = default;
} // storage
-
-template class metrics::LoadMetric<storage::PersistenceOperationMetricSet>;
-template class metrics::SumMetric<storage::PersistenceOperationMetricSet>;
diff --git a/storage/src/vespa/storage/distributor/distributormetricsset.h b/storage/src/vespa/storage/distributor/distributormetricsset.h
index ce4025d8311..89d34fd6474 100644
--- a/storage/src/vespa/storage/distributor/distributormetricsset.h
+++ b/storage/src/vespa/storage/distributor/distributormetricsset.h
@@ -4,9 +4,7 @@
#include "persistence_operation_metric_set.h"
#include "update_metric_set.h"
#include "visitormetricsset.h"
-#include <vespa/metrics/metrics.h>
#include <vespa/metrics/common/memory_usage_metrics.h>
-#include <vespa/documentapi/loadtypes/loadtypeset.h>
namespace vespalib { class MemoryUsage; }
@@ -21,17 +19,17 @@ struct BucketDbMetrics : metrics::MetricSet {
class DistributorMetricSet : public metrics::MetricSet {
public:
- metrics::LoadMetric<PersistenceOperationMetricSet> puts;
- metrics::LoadMetric<UpdateMetricSet> updates;
- metrics::LoadMetric<PersistenceOperationMetricSet> update_puts;
- metrics::LoadMetric<PersistenceOperationMetricSet> update_gets;
- metrics::LoadMetric<PersistenceOperationMetricSet> update_metadata_gets;
- metrics::LoadMetric<PersistenceOperationMetricSet> removes;
- metrics::LoadMetric<PersistenceOperationMetricSet> removelocations;
- metrics::LoadMetric<PersistenceOperationMetricSet> gets;
- metrics::LoadMetric<PersistenceOperationMetricSet> stats;
- metrics::LoadMetric<PersistenceOperationMetricSet> getbucketlists;
- metrics::LoadMetric<VisitorMetricSet> visits;
+ PersistenceOperationMetricSet puts;
+ UpdateMetricSet updates;
+ PersistenceOperationMetricSet update_puts;
+ PersistenceOperationMetricSet update_gets;
+ PersistenceOperationMetricSet update_metadata_gets;
+ PersistenceOperationMetricSet removes;
+ PersistenceOperationMetricSet removelocations;
+ PersistenceOperationMetricSet gets;
+ PersistenceOperationMetricSet stats;
+ PersistenceOperationMetricSet getbucketlists;
+ VisitorMetricSet visits;
metrics::DoubleAverageMetric stateTransitionTime;
metrics::DoubleAverageMetric set_cluster_state_processing_time;
metrics::DoubleAverageMetric activate_cluster_state_processing_time;
@@ -41,7 +39,7 @@ public:
BucketDbMetrics mutable_dbs;
BucketDbMetrics read_only_dbs;
- explicit DistributorMetricSet(const metrics::LoadTypeSet& lt);
+ explicit DistributorMetricSet();
~DistributorMetricSet() override;
};
diff --git a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
index c580e4aa419..1adb634817e 100644
--- a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
+++ b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
@@ -241,8 +241,7 @@ void ExternalOperationHandler::bounce_or_invoke_read_only_op(
IMPL_MSG_COMMAND_H(ExternalOperationHandler, Put)
{
- const documentapi::LoadType & loadType = cmd->getLoadType();
- auto& metrics = getMetrics().puts[loadType];
+ auto& metrics = getMetrics().puts;
if (!checkTimestampMutationPreconditions(*cmd, getBucketId(cmd->getDocumentId()), metrics)) {
return true;
}
@@ -256,7 +255,7 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, Put)
document::BucketSpace bucketSpace = cmd->getBucket().getBucketSpace();
_op = std::make_shared<PutOperation>(*this,
_bucketSpaceRepo.get(bucketSpace),
- std::move(cmd), getMetrics().puts[loadType], std::move(handle));
+ std::move(cmd), getMetrics().puts, std::move(handle));
} else {
sendUp(makeConcurrentMutationRejectionReply(*cmd, cmd->getDocumentId(), metrics));
}
@@ -267,8 +266,7 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, Put)
IMPL_MSG_COMMAND_H(ExternalOperationHandler, Update)
{
- const documentapi::LoadType & loadType = cmd->getLoadType();
- auto& metrics = getMetrics().updates[loadType];
+ auto& metrics = getMetrics().updates;
if (!checkTimestampMutationPreconditions(*cmd, getBucketId(cmd->getDocumentId()), metrics)) {
return true;
}
@@ -292,8 +290,7 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, Update)
IMPL_MSG_COMMAND_H(ExternalOperationHandler, Remove)
{
- const documentapi::LoadType & loadType = cmd->getLoadType();
- auto& metrics = getMetrics().removes[loadType];
+ auto& metrics = getMetrics().removes;
if (!checkTimestampMutationPreconditions(*cmd, getBucketId(cmd->getDocumentId()), metrics)) {
return true;
}
@@ -306,7 +303,7 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, Remove)
auto &distributorBucketSpace(_bucketSpaceRepo.get(cmd->getBucket().getBucketSpace()));
_op = std::make_shared<RemoveOperation>(*this, distributorBucketSpace, std::move(cmd),
- getMetrics().removes[loadType], std::move(handle));
+ getMetrics().removes, std::move(handle));
} else {
sendUp(makeConcurrentMutationRejectionReply(*cmd, cmd->getDocumentId(), metrics));
}
@@ -320,13 +317,13 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, RemoveLocation)
RemoveLocationOperation::getBucketId(*this, *cmd, bid);
document::Bucket bucket(cmd->getBucket().getBucketSpace(), bid);
- auto& metrics = getMetrics().removelocations[cmd->getLoadType()];
+ auto& metrics = getMetrics().removelocations;
if (!checkTimestampMutationPreconditions(*cmd, bucket.getBucketId(), metrics)) {
return true;
}
_op = std::make_shared<RemoveLocationOperation>(*this, _bucketSpaceRepo.get(cmd->getBucket().getBucketSpace()),
- std::move(cmd), getMetrics().removelocations[cmd->getLoadType()]);
+ std::move(cmd), getMetrics().removelocations);
return true;
}
@@ -338,7 +335,7 @@ api::InternalReadConsistency ExternalOperationHandler::desired_get_read_consiste
std::shared_ptr<Operation> ExternalOperationHandler::try_generate_get_operation(const std::shared_ptr<api::GetCommand>& cmd) {
document::Bucket bucket(cmd->getBucket().getBucketSpace(), getBucketId(cmd->getDocumentId()));
- auto& metrics = getMetrics().gets[cmd->getLoadType()];
+ auto& metrics = getMetrics().gets;
auto snapshot = getDistributor().read_snapshot_for_bucket(bucket);
if (!snapshot.is_routable()) {
const auto& ctx = snapshot.context();
@@ -367,7 +364,7 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, Get)
IMPL_MSG_COMMAND_H(ExternalOperationHandler, StatBucket)
{
- auto& metrics = getMetrics().stats[cmd->getLoadType()];
+ auto& metrics = getMetrics().stats;
bounce_or_invoke_read_only_op(*cmd, cmd->getBucket(), metrics, [&](auto& bucket_space_repo) {
auto& bucket_space = bucket_space_repo.get(cmd->getBucket().getBucketSpace());
_op = std::make_shared<StatBucketOperation>(*this, bucket_space, cmd);
@@ -377,7 +374,7 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, StatBucket)
IMPL_MSG_COMMAND_H(ExternalOperationHandler, GetBucketList)
{
- auto& metrics = getMetrics().getbucketlists[cmd->getLoadType()];
+ auto& metrics = getMetrics().getbucketlists;
bounce_or_invoke_read_only_op(*cmd, cmd->getBucket(), metrics, [&](auto& bucket_space_repo) {
auto& bucket_space = bucket_space_repo.get(cmd->getBucket().getBucketSpace());
auto& bucket_database = bucket_space.getBucketDatabase();
@@ -392,7 +389,7 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, CreateVisitor)
const DistributorConfiguration& config(getDistributor().getConfig());
VisitorOperation::Config visitorConfig(config.getMinBucketsPerVisitor(), config.getMaxVisitorsPerNodePerClientVisitor());
auto &distributorBucketSpace(_bucketSpaceRepo.get(cmd->getBucket().getBucketSpace()));
- _op = Operation::SP(new VisitorOperation(*this, distributorBucketSpace, cmd, visitorConfig, getMetrics().visits[cmd->getLoadType()]));
+ _op = Operation::SP(new VisitorOperation(*this, distributorBucketSpace, cmd, visitorConfig, getMetrics().visits));
return true;
}
diff --git a/storage/src/vespa/storage/distributor/idealstatemetricsset.h b/storage/src/vespa/storage/distributor/idealstatemetricsset.h
index 2679da17598..c1fb39bb50a 100644
--- a/storage/src/vespa/storage/distributor/idealstatemetricsset.h
+++ b/storage/src/vespa/storage/distributor/idealstatemetricsset.h
@@ -1,7 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/metrics/countmetric.h>
#include <vespa/storage/distributor/operations/idealstate/idealstateoperation.h>
namespace storage {
diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
index 19427d8037e..c587efd0142 100644
--- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
@@ -27,10 +27,10 @@ TwoPhaseUpdateOperation::TwoPhaseUpdateOperation(
DistributorMetricSet& metrics,
SequencingHandle sequencingHandle)
: SequencedOperation(std::move(sequencingHandle)),
- _updateMetric(metrics.updates[msg->getLoadType()]),
- _putMetric(metrics.update_puts[msg->getLoadType()]),
- _getMetric(metrics.update_gets[msg->getLoadType()]),
- _metadata_get_metrics(metrics.update_metadata_gets[msg->getLoadType()]),
+ _updateMetric(metrics.updates),
+ _putMetric(metrics.update_puts),
+ _getMetric(metrics.update_gets),
+ _metadata_get_metrics(metrics.update_metadata_gets),
_updateCmd(std::move(msg)),
_updateReply(),
_manager(manager),
diff --git a/storage/src/vespa/storage/distributor/persistence_operation_metric_set.h b/storage/src/vespa/storage/distributor/persistence_operation_metric_set.h
index 1299fdad2ad..d3e022c08b8 100644
--- a/storage/src/vespa/storage/distributor/persistence_operation_metric_set.h
+++ b/storage/src/vespa/storage/distributor/persistence_operation_metric_set.h
@@ -2,8 +2,10 @@
#pragma once
-#include <vespa/metrics/metrics.h>
-#include <vespa/documentapi/loadtypes/loadtypeset.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/countmetric.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/metrics/summetric.h>
#include <mutex>
namespace storage {
diff --git a/storage/src/vespa/storage/distributor/update_metric_set.cpp b/storage/src/vespa/storage/distributor/update_metric_set.cpp
index 1edde270517..fbb5d700aa9 100644
--- a/storage/src/vespa/storage/distributor/update_metric_set.cpp
+++ b/storage/src/vespa/storage/distributor/update_metric_set.cpp
@@ -1,15 +1,13 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "update_metric_set.h"
-#include <vespa/metrics/loadmetric.hpp>
-#include <vespa/metrics/summetric.hpp>
namespace storage {
using metrics::MetricSet;
UpdateMetricSet::UpdateMetricSet(MetricSet* owner)
- : PersistenceOperationMetricSet("updates", owner),
+ : PersistenceOperationMetricSet("updates.sum", owner),
diverging_timestamp_updates("diverging_timestamp_updates", {},
"Number of updates that report they were performed against "
"divergent version timestamps on different replicas", this),
@@ -32,6 +30,3 @@ UpdateMetricSet::clone(std::vector<Metric::UP>& ownerList, CopyType copyType,
}
}
-
-template class metrics::LoadMetric<storage::UpdateMetricSet>;
-template class metrics::SumMetric<storage::UpdateMetricSet>;
diff --git a/storage/src/vespa/storage/distributor/update_metric_set.h b/storage/src/vespa/storage/distributor/update_metric_set.h
index 8a88aa6b9a9..e31ec714adf 100644
--- a/storage/src/vespa/storage/distributor/update_metric_set.h
+++ b/storage/src/vespa/storage/distributor/update_metric_set.h
@@ -2,8 +2,6 @@
#pragma once
#include "persistence_operation_metric_set.h"
-#include <vespa/documentapi/loadtypes/loadtypeset.h>
-#include <vespa/metrics/metrics.h>
namespace storage {
diff --git a/storage/src/vespa/storage/distributor/visitormetricsset.cpp b/storage/src/vespa/storage/distributor/visitormetricsset.cpp
index 84b1174962c..3ca92c7df79 100644
--- a/storage/src/vespa/storage/distributor/visitormetricsset.cpp
+++ b/storage/src/vespa/storage/distributor/visitormetricsset.cpp
@@ -1,15 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "visitormetricsset.h"
-#include <vespa/metrics/loadmetric.hpp>
-#include <vespa/metrics/summetric.hpp>
namespace storage {
using metrics::MetricSet;
VisitorMetricSet::VisitorMetricSet(MetricSet* owner)
- : PersistenceOperationMetricSet("visitor", owner),
+ : PersistenceOperationMetricSet("visitor.sum", owner),
buckets_per_visitor("buckets_per_visitor", {},
"The number of sub buckets visited as part of a "
"single client visitor command", this),
@@ -22,7 +20,7 @@ VisitorMetricSet::VisitorMetricSet(MetricSet* owner)
{
}
-VisitorMetricSet::~VisitorMetricSet() { }
+VisitorMetricSet::~VisitorMetricSet() = default;
MetricSet *
VisitorMetricSet::clone(std::vector<Metric::UP>& ownerList, CopyType copyType,
@@ -35,6 +33,3 @@ VisitorMetricSet::clone(std::vector<Metric::UP>& ownerList, CopyType copyType,
}
}
-
-template class metrics::LoadMetric<storage::VisitorMetricSet>;
-template class metrics::SumMetric<storage::VisitorMetricSet>;
diff --git a/storage/src/vespa/storage/distributor/visitormetricsset.h b/storage/src/vespa/storage/distributor/visitormetricsset.h
index 7ea78a887a8..93258c9a416 100644
--- a/storage/src/vespa/storage/distributor/visitormetricsset.h
+++ b/storage/src/vespa/storage/distributor/visitormetricsset.h
@@ -2,8 +2,6 @@
#pragma once
#include "persistence_operation_metric_set.h"
-#include <vespa/metrics/metrics.h>
-#include <vespa/documentapi/loadtypes/loadtypeset.h>
namespace storage {
diff --git a/storage/src/vespa/storage/persistence/asynchandler.cpp b/storage/src/vespa/storage/persistence/asynchandler.cpp
index 5344553dd45..5ec1623c599 100644
--- a/storage/src/vespa/storage/persistence/asynchandler.cpp
+++ b/storage/src/vespa/storage/persistence/asynchandler.cpp
@@ -98,7 +98,7 @@ MessageTracker::UP
AsyncHandler::handlePut(api::PutCommand& cmd, MessageTracker::UP trackerUP) const
{
MessageTracker & tracker = *trackerUP;
- auto& metrics = _env._metrics.put[cmd.getLoadType()];
+ auto& metrics = _env._metrics.put;
tracker.setMetric(metrics);
metrics.request_size.addValue(cmd.getApproxByteSize());
@@ -124,7 +124,7 @@ MessageTracker::UP
AsyncHandler::handleUpdate(api::UpdateCommand& cmd, MessageTracker::UP trackerUP) const
{
MessageTracker & tracker = *trackerUP;
- auto& metrics = _env._metrics.update[cmd.getLoadType()];
+ auto& metrics = _env._metrics.update;
tracker.setMetric(metrics);
metrics.request_size.addValue(cmd.getApproxByteSize());
@@ -154,7 +154,7 @@ MessageTracker::UP
AsyncHandler::handleRemove(api::RemoveCommand& cmd, MessageTracker::UP trackerUP) const
{
MessageTracker & tracker = *trackerUP;
- auto& metrics = _env._metrics.remove[cmd.getLoadType()];
+ auto& metrics = _env._metrics.remove;
tracker.setMetric(metrics);
metrics.request_size.addValue(cmd.getApproxByteSize());
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
index b3d4ff0c730..b081d5f75e9 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
@@ -17,7 +17,7 @@
#include "filestorhandler.h"
#include <vespa/document/bucket/bucketid.h>
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metrictimer.h>
#include <vespa/storage/common/servicelayercomponent.h>
#include <vespa/storageframework/generic/metric/metricupdatehook.h>
#include <vespa/storageapi/messageapi/storagereply.h>
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
index ef40929cb88..fc0f7cd0b15 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
@@ -55,7 +55,7 @@ FileStorManager(const config::ConfigUri & configUri, spi::PersistenceProvider& p
_threadLockCheckInterval(60),
_failDiskOnError(false),
_use_async_message_handling_on_schedule(false),
- _metrics(std::make_unique<FileStorMetrics>(_component.getLoadTypes()->getMetricLoadTypes())),
+ _metrics(std::make_unique<FileStorMetrics>()),
_closed(false),
_lock()
{
@@ -171,8 +171,7 @@ FileStorManager::configure(std::unique_ptr<vespa::config::content::StorFilestorC
_config = std::move(config);
size_t numThreads = _config->numThreads;
size_t numStripes = std::max(size_t(1u), numThreads / 2);
- _metrics->initDiskMetrics(_component.getLoadTypes()->getMetricLoadTypes(), numStripes,
- computeAllPossibleHandlerThreads(*_config));
+ _metrics->initDiskMetrics(numStripes, computeAllPossibleHandlerThreads(*_config));
_filestorHandler = std::make_unique<FileStorHandlerImpl>(numThreads, numStripes, *this, *_metrics, _compReg);
uint32_t numResponseThreads = computeNumResponseThreads(_config->numResponseThreads);
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
index 7abb41f4741..af290b7b085 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
@@ -9,7 +9,6 @@
#pragma once
#include "filestorhandler.h"
-#include "filestormetrics.h"
#include <vespa/vespalib/util/document_runnable.h>
#include <vespa/vespalib/util/isequencedtaskexecutor.h>
#include <vespa/document/bucket/bucketid.h>
@@ -43,6 +42,7 @@ class BucketOwnershipNotifier;
class AbortBucketOperationsCommand;
struct DoneInitializeHandler;
class PersistenceHandler;
+struct FileStorMetrics;
class FileStorManager : public StorageLinkQueued,
public framework::HtmlStatusReporter,
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp
index 996e3bfe515..2c7b74cebbd 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp
@@ -1,14 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "filestormetrics.h"
-#include <vespa/metrics/loadmetric.hpp>
#include <vespa/metrics/summetric.hpp>
#include <sstream>
namespace storage {
using metrics::MetricSet;
-using metrics::LoadTypeSet;
+// TODO Vespa 8 all metrics with .sum in the name should have that removed.
FileStorThreadMetrics::Op::Op(const std::string& id, const std::string& name, MetricSet* owner)
: MetricSet(id, {}, name + " load in filestor thread", owner),
_name(name),
@@ -109,7 +108,7 @@ FileStorThreadMetrics::OpWithNotFound::clone(std::vector<Metric::UP>& ownerList,
}
FileStorThreadMetrics::Update::Update(MetricSet* owner)
- : OpWithTestAndSetFailed("update", "Update", owner),
+ : OpWithTestAndSetFailed("update.sum", "Update", owner),
latencyRead("latency_read", {}, "Latency of the source read in the request.", this)
{ }
@@ -128,7 +127,7 @@ FileStorThreadMetrics::Update::clone(std::vector<Metric::UP>& ownerList,
}
FileStorThreadMetrics::Visitor::Visitor(MetricSet* owner)
- : Op("visit", "Visit", owner),
+ : Op("visit.sum", "Visit", owner),
documentsPerIterate("docs", {}, "Number of entries read per iterate call", this)
{ }
@@ -146,20 +145,20 @@ FileStorThreadMetrics::Visitor::clone(std::vector<Metric::UP>& ownerList,
return (Visitor*) (new Visitor(owner))->assignValues(*this);
}
-FileStorThreadMetrics::FileStorThreadMetrics(const std::string& name, const std::string& desc, const LoadTypeSet& lt)
+FileStorThreadMetrics::FileStorThreadMetrics(const std::string& name, const std::string& desc)
: MetricSet(name, {{"filestor"},{"partofsum"}}, desc),
operations("operations", {}, "Number of operations processed.", this),
failedOperations("failedoperations", {}, "Number of operations throwing exceptions.", this),
- put(lt, PutMetricType("put", "Put"), this),
- get(lt, GetMetricType("get", "Get"), this),
- remove(lt, RemoveMetricType("remove", "Remove"), this),
- removeLocation(lt, Op("remove_location", "Remove location"), this),
- statBucket(lt, Op("stat_bucket", "Stat bucket"), this),
- update(lt, Update(), this),
- revert(lt, OpWithNotFound("revert", "Revert"), this),
+ put("put.sum", "Put", this),
+ get("get.sum", "Get", this),
+ remove("remove.sum", "Remove", this),
+ removeLocation("remove_location.sum", "Remove location", this),
+ statBucket("stat_bucket", "Stat bucket", this),
+ update(this),
+ revert("revert", "Revert", this),
createIterator("createiterator", {}, this),
- visit(lt, Visitor(), this),
- multiOp(lt, Op("multioperations", "The number of multioperations that have been created"), this),
+ visit(this),
+ multiOp("multioperations", "The number of multioperations that have been created", this),
createBuckets("createbuckets", "Number of buckets that has been created.", this),
deleteBuckets("deletebuckets", "Number of buckets that has been deleted.", this),
repairs("bucketverified", "Number of times buckets have been checked.", this),
@@ -201,7 +200,7 @@ FileStorDiskMetrics::FileStorDiskMetrics(const std::string& name, const std::str
: MetricSet(name, {{"partofsum"}}, description, owner),
sumThreads("allthreads", {{"sum"}}, "", this),
sumStripes("allstripes", {{"sum"}}, "", this),
- averageQueueWaitingTime("averagequeuewait", {}, "Average time an operation spends in input queue.", this),
+ averageQueueWaitingTime("averagequeuewait.sum", {}, "Average time an operation spends in input queue.", this),
queueSize("queuesize", {}, "Size of input message queue.", this),
pendingMerges("pendingmerge", {}, "Number of buckets currently being merged.", this),
waitingForLockHitRate("waitingforlockrate", {},
@@ -216,7 +215,7 @@ FileStorDiskMetrics::FileStorDiskMetrics(const std::string& name, const std::str
FileStorDiskMetrics::~FileStorDiskMetrics() = default;
void
-FileStorDiskMetrics::initDiskMetrics(const LoadTypeSet& loadTypes, uint32_t numStripes, uint32_t threadsPerDisk)
+FileStorDiskMetrics::initDiskMetrics(uint32_t numStripes, uint32_t threadsPerDisk)
{
threads.clear();
threads.resize(threadsPerDisk);
@@ -225,7 +224,7 @@ FileStorDiskMetrics::initDiskMetrics(const LoadTypeSet& loadTypes, uint32_t numS
std::ostringstream name;
name << "thread" << i;
desc << "Thread " << i << '/' << threadsPerDisk;
- threads[i] = std::make_shared<FileStorThreadMetrics>(name.str(), desc.str(), loadTypes);
+ threads[i] = std::make_shared<FileStorThreadMetrics>(name.str(), desc.str());
registerMetric(*threads[i]);
sumThreads.addMetricToSum(*threads[i]);
}
@@ -242,7 +241,7 @@ FileStorDiskMetrics::initDiskMetrics(const LoadTypeSet& loadTypes, uint32_t numS
}
}
-FileStorMetrics::FileStorMetrics(const LoadTypeSet&)
+FileStorMetrics::FileStorMetrics()
: MetricSet("filestor", {{"filestor"}}, ""),
sum("alldisks", {{"sum"}}, "", this),
directoryEvents("directoryevents", {}, "Number of directory events received.", this),
@@ -254,26 +253,14 @@ FileStorMetrics::FileStorMetrics(const LoadTypeSet&)
FileStorMetrics::~FileStorMetrics() = default;
-void FileStorMetrics::initDiskMetrics(const LoadTypeSet& loadTypes, uint32_t numStripes, uint32_t threadsPerDisk)
+void FileStorMetrics::initDiskMetrics(uint32_t numStripes, uint32_t threadsPerDisk)
{
assert( ! disk);
// Currently FileStorHandlerImpl expects metrics to exist for
// disks that are not in use too.
disk = std::make_shared<FileStorDiskMetrics>( "disk_0", "Disk 0", this);
sum.addMetricToSum(*disk);
- disk->initDiskMetrics(loadTypes, numStripes, threadsPerDisk);
+ disk->initDiskMetrics(numStripes, threadsPerDisk);
}
}
-
-template class metrics::LoadMetric<storage::FileStorThreadMetrics::Op>;
-template class metrics::LoadMetric<storage::FileStorThreadMetrics::OpWithNotFound>;
-template class metrics::LoadMetric<storage::FileStorThreadMetrics::Update>;
-template class metrics::LoadMetric<storage::FileStorThreadMetrics::Visitor>;
-template class metrics::LoadMetric<storage::FileStorThreadMetrics::PutMetricType>;
-template class metrics::LoadMetric<storage::FileStorThreadMetrics::GetMetricType>;
-template class metrics::LoadMetric<storage::FileStorThreadMetrics::RemoveMetricType>;
-template class metrics::SumMetric<storage::FileStorThreadMetrics::Op>;
-template class metrics::SumMetric<storage::FileStorThreadMetrics::OpWithNotFound>;
-template class metrics::SumMetric<storage::FileStorThreadMetrics::Update>;
-template class metrics::SumMetric<storage::FileStorThreadMetrics::Visitor>;
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormetrics.h b/storage/src/vespa/storage/persistence/filestorage/filestormetrics.h
index aecbfc1ae2b..bc60fe01dfa 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormetrics.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormetrics.h
@@ -11,8 +11,8 @@
#pragma once
#include "merge_handler_metrics.h"
-#include <vespa/metrics/metrics.h>
-#include <vespa/documentapi/loadtypes/loadtypeset.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/summetric.h>
namespace storage {
@@ -91,16 +91,16 @@ struct FileStorThreadMetrics : public metrics::MetricSet
metrics::LongCountMetric operations;
metrics::LongCountMetric failedOperations;
- metrics::LoadMetric<PutMetricType> put;
- metrics::LoadMetric<GetMetricType> get;
- metrics::LoadMetric<RemoveMetricType> remove;
- metrics::LoadMetric<Op> removeLocation;
- metrics::LoadMetric<Op> statBucket;
- metrics::LoadMetric<Update> update;
- metrics::LoadMetric<OpWithNotFound> revert;
+ PutMetricType put;
+ GetMetricType get;
+ RemoveMetricType remove;
+ Op removeLocation;
+ Op statBucket;
+ Update update;
+ OpWithNotFound revert;
Op createIterator;
- metrics::LoadMetric<Visitor> visit;
- metrics::LoadMetric<Op> multiOp;
+ Visitor visit;
+ Op multiOp;
Op createBuckets;
Op deleteBuckets;
Op repairs;
@@ -121,7 +121,7 @@ struct FileStorThreadMetrics : public metrics::MetricSet
MergeHandlerMetrics merge_handler_metrics;
metrics::LongAverageMetric batchingSize;
- FileStorThreadMetrics(const std::string& name, const std::string& desc, const metrics::LoadTypeSet& lt);
+ FileStorThreadMetrics(const std::string& name, const std::string& desc);
~FileStorThreadMetrics() override;
};
@@ -152,7 +152,7 @@ public:
FileStorDiskMetrics(const std::string& name, const std::string& description, MetricSet* owner);
~FileStorDiskMetrics() override;
- void initDiskMetrics(const metrics::LoadTypeSet& loadTypes, uint32_t numStripes, uint32_t threadsPerDisk);
+ void initDiskMetrics(uint32_t numStripes, uint32_t threadsPerDisk);
};
struct FileStorMetrics : public metrics::MetricSet
@@ -164,10 +164,10 @@ struct FileStorMetrics : public metrics::MetricSet
metrics::LongCountMetric diskEvents;
metrics::LongAverageMetric bucket_db_init_latency;
- explicit FileStorMetrics(const metrics::LoadTypeSet&);
+ explicit FileStorMetrics();
~FileStorMetrics() override;
- void initDiskMetrics(const metrics::LoadTypeSet& loadTypes, uint32_t numStripes, uint32_t threadsPerDisk);
+ void initDiskMetrics(uint32_t numStripes, uint32_t threadsPerDisk);
};
}
diff --git a/storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.cpp b/storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.cpp
index d4e82b8a64f..ee2a2d933c3 100644
--- a/storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.cpp
@@ -1,5 +1,6 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "merge_handler_metrics.h"
+#include <vespa/metrics/metricset.h>
namespace storage {
diff --git a/storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.h b/storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.h
index ffa3cf204a3..bd1a6251ff6 100644
--- a/storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.h
+++ b/storage/src/vespa/storage/persistence/filestorage/merge_handler_metrics.h
@@ -1,8 +1,10 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/metrics/countmetric.h>
+namespace metrics { class MetricSet; }
namespace storage {
// Provides a convenient wrapper for all MergeHandler-related metrics.
diff --git a/storage/src/vespa/storage/persistence/processallhandler.cpp b/storage/src/vespa/storage/persistence/processallhandler.cpp
index a9c1aafd4d9..9cf570ef7a4 100644
--- a/storage/src/vespa/storage/persistence/processallhandler.cpp
+++ b/storage/src/vespa/storage/persistence/processallhandler.cpp
@@ -76,7 +76,7 @@ public:
MessageTracker::UP
ProcessAllHandler::handleRemoveLocation(api::RemoveLocationCommand& cmd, MessageTracker::UP tracker) const
{
- tracker->setMetric(_env._metrics.removeLocation[cmd.getLoadType()]);
+ tracker->setMetric(_env._metrics.removeLocation);
LOG(debug, "RemoveLocation(%s): using selection '%s'",
cmd.getBucketId().toString().c_str(),
@@ -95,7 +95,7 @@ ProcessAllHandler::handleRemoveLocation(api::RemoveLocationCommand& cmd, Message
MessageTracker::UP
ProcessAllHandler::handleStatBucket(api::StatBucketCommand& cmd, MessageTracker::UP tracker) const
{
- tracker->setMetric(_env._metrics.statBucket[cmd.getLoadType()]);
+ tracker->setMetric(_env._metrics.statBucket);
std::ostringstream ost;
ost << "Persistence bucket " << cmd.getBucketId() << "\n";
diff --git a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp
index 6ed928245db..5a5d3dcabca 100644
--- a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp
+++ b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp
@@ -64,7 +64,7 @@ SimpleMessageHandler::SimpleMessageHandler(const PersistenceUtil& env, spi::Pers
MessageTracker::UP
SimpleMessageHandler::handleGet(api::GetCommand& cmd, MessageTracker::UP tracker) const
{
- auto& metrics = _env._metrics.get[cmd.getLoadType()];
+ auto& metrics = _env._metrics.get;
tracker->setMetric(metrics);
metrics.request_size.addValue(cmd.getApproxByteSize());
@@ -89,7 +89,7 @@ SimpleMessageHandler::handleGet(api::GetCommand& cmd, MessageTracker::UP tracker
MessageTracker::UP
SimpleMessageHandler::handleRevert(api::RevertCommand& cmd, MessageTracker::UP tracker) const
{
- tracker->setMetric(_env._metrics.revert[cmd.getLoadType()]);
+ tracker->setMetric(_env._metrics.revert);
spi::Bucket b = spi::Bucket(cmd.getBucket());
const std::vector<api::Timestamp> & tokens = cmd.getRevertTokens();
for (const api::Timestamp & token : tokens) {
@@ -183,13 +183,12 @@ SimpleMessageHandler::handleDeleteBucket(api::DeleteBucketCommand& cmd, MessageT
MessageTracker::UP
SimpleMessageHandler::handleGetIter(GetIterCommand& cmd, MessageTracker::UP tracker) const
{
- tracker->setMetric(_env._metrics.visit[cmd.getLoadType()]);
+ tracker->setMetric(_env._metrics.visit);
spi::IterateResult result(_spi.iterate(cmd.getIteratorId(), cmd.getMaxByteSize(), tracker->context()));
if (tracker->checkForError(result)) {
auto reply = std::make_shared<GetIterReply>(cmd);
reply->getEntries() = result.steal_entries();
- _env._metrics.visit[cmd.getLoadType()].
- documentsPerIterate.addValue(reply->getEntries().size());
+ _env._metrics.visit.documentsPerIterate.addValue(reply->getEntries().size());
if (result.isCompleted()) {
reply->setCompleted();
}
diff --git a/storage/src/vespa/storage/storageserver/bouncer_metrics.h b/storage/src/vespa/storage/storageserver/bouncer_metrics.h
index 9842bed1c6f..a2831092926 100644
--- a/storage/src/vespa/storage/storageserver/bouncer_metrics.h
+++ b/storage/src/vespa/storage/storageserver/bouncer_metrics.h
@@ -2,7 +2,8 @@
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/countmetric.h>
namespace storage {
diff --git a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp
index aec0adf790c..a736ea58406 100644
--- a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp
+++ b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp
@@ -9,6 +9,8 @@
#include <vespa/storage/common/nodestateupdater.h>
#include <vespa/storage/common/content_bucket_space_repo.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/metrics/metrictimer.h>
+
#include <vespa/log/bufferedlogger.h>
LOG_SETUP(".bucketownershiphandler");
@@ -35,9 +37,7 @@ ChangedBucketOwnershipHandler::ChangedBucketOwnershipHandler(
_component.registerMetric(_metrics);
}
-ChangedBucketOwnershipHandler::~ChangedBucketOwnershipHandler()
-{
-}
+ChangedBucketOwnershipHandler::~ChangedBucketOwnershipHandler() = default;
void
ChangedBucketOwnershipHandler::configure(
diff --git a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h
index 0fc456b515c..b2661ce0d8d 100644
--- a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h
+++ b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h
@@ -4,11 +4,13 @@
#include <vespa/document/bucket/bucketid.h>
#include <vespa/storage/common/storagelink.h>
#include <vespa/vdslib/distribution/distribution.h>
-#include <vespa/metrics/metrics.h>
#include <vespa/config/config.h>
#include <vespa/config-persistence.h>
#include <vespa/storage/common/servicelayercomponent.h>
#include <vespa/storage/persistence/messages.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/metrics/countmetric.h>
+#include <vespa/metrics/metricset.h>
#include <atomic>
#include <vector>
#include <unordered_map>
diff --git a/storage/src/vespa/storage/storageserver/communicationmanagermetrics.h b/storage/src/vespa/storage/storageserver/communicationmanagermetrics.h
index cc62b93e6d4..2e439bc9266 100644
--- a/storage/src/vespa/storage/storageserver/communicationmanagermetrics.h
+++ b/storage/src/vespa/storage/storageserver/communicationmanagermetrics.h
@@ -8,7 +8,9 @@
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/metrics/countmetric.h>
namespace storage {
diff --git a/storage/src/vespa/storage/storageserver/fnet_metrics_wrapper.h b/storage/src/vespa/storage/storageserver/fnet_metrics_wrapper.h
index dacb9e9f52c..15bbf31e9e6 100644
--- a/storage/src/vespa/storage/storageserver/fnet_metrics_wrapper.h
+++ b/storage/src/vespa/storage/storageserver/fnet_metrics_wrapper.h
@@ -2,7 +2,9 @@
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/valuemetric.h>
+
#include <vespa/fnet/connection.h>
namespace storage {
diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp
index fd68b8ef821..37a86413500 100644
--- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp
+++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp
@@ -1,7 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "mergethrottler.h"
-#include <vespa/vdslib/state/cluster_state_bundle.h>
#include <vespa/storage/common/nodestateupdater.h>
#include <vespa/storage/persistence/messages.h>
#include <vespa/messagebus/message.h>
@@ -66,7 +65,7 @@ MergeThrottler::ChainedMergeState::ChainedMergeState(const api::StorageMessage::
_cycleBroken(false),
_aborted(false)
{ }
-MergeThrottler::ChainedMergeState::~ChainedMergeState() {}
+MergeThrottler::ChainedMergeState::~ChainedMergeState() = default;
MergeThrottler::Metrics::Metrics(metrics::MetricSet* owner)
: metrics::MetricSet("mergethrottler", {}, "", owner),
@@ -75,7 +74,7 @@ MergeThrottler::Metrics::Metrics(metrics::MetricSet* owner)
chaining("mergechains", this),
local("locallyexecutedmerges", this)
{ }
-MergeThrottler::Metrics::~Metrics() {}
+MergeThrottler::Metrics::~Metrics() = default;
MergeThrottler::MergeFailureMetrics::MergeFailureMetrics(metrics::MetricSet* owner)
: metrics::MetricSet("failures", {}, "Detailed failure statistics", owner),
@@ -100,7 +99,7 @@ MergeThrottler::MergeFailureMetrics::MergeFailureMetrics(metrics::MetricSet* own
sum.addMetricToSum(rejected);
sum.addMetricToSum(other);
}
-MergeThrottler::MergeFailureMetrics::~MergeFailureMetrics() { }
+MergeThrottler::MergeFailureMetrics::~MergeFailureMetrics() = default;
MergeThrottler::MergeOperationMetrics::MergeOperationMetrics(const std::string& name, metrics::MetricSet* owner)
@@ -109,7 +108,7 @@ MergeThrottler::MergeOperationMetrics::MergeOperationMetrics(const std::string&
failures(this)
{
}
-MergeThrottler::MergeOperationMetrics::~MergeOperationMetrics() { }
+MergeThrottler::MergeOperationMetrics::~MergeOperationMetrics() = default;
MergeThrottler::MergeNodeSequence::MergeNodeSequence(
const api::MergeBucketCommand& cmd,
diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.h b/storage/src/vespa/storage/storageserver/mergethrottler.h
index 9e0e9c08b3c..e8815eee680 100644
--- a/storage/src/vespa/storage/storageserver/mergethrottler.h
+++ b/storage/src/vespa/storage/storageserver/mergethrottler.h
@@ -16,7 +16,11 @@
#include <vespa/document/bucket/bucket.h>
#include <vespa/vespalib/util/document_runnable.h>
#include <vespa/messagebus/staticthrottlepolicy.h>
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/summetric.h>
+#include <vespa/metrics/countmetric.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/metrics/metrictimer.h>
#include <vespa/config/config.h>
#include <chrono>
@@ -44,7 +48,7 @@ public:
metrics::LongCountMetric other;
MergeFailureMetrics(metrics::MetricSet* owner);
- ~MergeFailureMetrics();
+ ~MergeFailureMetrics() override;
};
class MergeOperationMetrics : public metrics::MetricSet {
diff --git a/storage/src/vespa/storage/storageserver/statereporter.h b/storage/src/vespa/storage/storageserver/statereporter.h
index b06e08c3ef5..72c2b856612 100644
--- a/storage/src/vespa/storage/storageserver/statereporter.h
+++ b/storage/src/vespa/storage/storageserver/statereporter.h
@@ -13,7 +13,6 @@
#include "applicationgenerationfetcher.h"
#include <vespa/storage/common/storagecomponent.h>
#include <vespa/storageframework/generic/status/statusreporter.h>
-#include <vespa/metrics/metrics.h>
#include <vespa/metrics/state_api_adapter.h>
#include <vespa/vespalib/net/metrics_producer.h>
#include <vespa/vespalib/net/state_api.h>
diff --git a/storage/src/vespa/storage/storageserver/storagemetricsset.h b/storage/src/vespa/storage/storageserver/storagemetricsset.h
index a315e974c01..7e8284fc734 100644
--- a/storage/src/vespa/storage/storageserver/storagemetricsset.h
+++ b/storage/src/vespa/storage/storageserver/storagemetricsset.h
@@ -4,7 +4,6 @@
#include "tls_statistics_metrics_wrapper.h"
#include "fnet_metrics_wrapper.h"
-#include <vespa/metrics/metrics.h>
namespace storage {
diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp
index c6d50e6dca6..2a6f45731f8 100644
--- a/storage/src/vespa/storage/storageserver/storagenode.cpp
+++ b/storage/src/vespa/storage/storageserver/storagenode.cpp
@@ -178,11 +178,11 @@ StorageNode::initialize()
initializeNodeSpecific();
- _statusMetrics.reset(new StatusMetricConsumer(
- _context.getComponentRegister(), _context.getComponentRegister().getMetricManager()));
- _stateReporter.reset(new StateReporter(
+ _statusMetrics = std::make_unique<StatusMetricConsumer>(
+ _context.getComponentRegister(), _context.getComponentRegister().getMetricManager());
+ _stateReporter = std::make_unique<StateReporter>(
_context.getComponentRegister(), _context.getComponentRegister().getMetricManager(),
- _generationFetcher));
+ _generationFetcher);
// Start deadlock detector
_deadLockDetector.reset(new DeadLockDetector(_context.getComponentRegister()));
diff --git a/storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.h b/storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.h
index e1852efa5e6..85a8584a591 100644
--- a/storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.h
+++ b/storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.h
@@ -1,7 +1,8 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/countmetric.h>
#include <vespa/vespalib/net/tls/statistics.h>
#include <chrono>
diff --git a/storage/src/vespa/storage/visiting/CMakeLists.txt b/storage/src/vespa/storage/visiting/CMakeLists.txt
index 05097163479..f8999cd7dcb 100644
--- a/storage/src/vespa/storage/visiting/CMakeLists.txt
+++ b/storage/src/vespa/storage/visiting/CMakeLists.txt
@@ -10,6 +10,7 @@ vespa_add_library(storage_visitor OBJECT
visitor.cpp
visitormanager.cpp
visitormetrics.cpp
+ visitorthreadmetrics.cpp
visitorthread.cpp
DEPENDS
)
diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp
index 16a9b26a754..a8582fcf403 100644
--- a/storage/src/vespa/storage/visiting/visitor.cpp
+++ b/storage/src/vespa/storage/visiting/visitor.cpp
@@ -623,7 +623,7 @@ Visitor::handleDocumentApiReply(mbus::Reply::UP reply, VisitorThreadMetrics& met
auto meta = _visitorTarget.releaseMetaForMessageId(messageId);
if (!reply->hasErrors()) {
- metrics.averageMessageSendTime[getLoadType()].addValue(
+ metrics.averageMessageSendTime.addValue(
(message->getTimeRemaining() - message->getTimeRemainingNow()).count() / 1000.0);
LOG(debug, "Visitor '%s' reply %s for message ID %" PRIu64 " was OK", _id.c_str(),
reply->toString().c_str(), messageId);
@@ -632,7 +632,7 @@ Visitor::handleDocumentApiReply(mbus::Reply::UP reply, VisitorThreadMetrics& met
return;
}
- metrics.visitorDestinationFailureReplies[getLoadType()].inc();
+ metrics.visitorDestinationFailureReplies.inc();
if (message->getType() == documentapi::DocumentProtocol::MESSAGE_VISITORINFO) {
LOG(debug, "Aborting visitor as we failed to talk to "
@@ -791,18 +791,14 @@ Visitor::onGetIterReply(const std::shared_ptr<GetIterReply>& reply,
if (isRunning()) {
MBUS_TRACE(reply->getTrace(), 5,
vespalib::make_string("Visitor %s handling block of %zu documents.",
- _id.c_str(),
- reply->getEntries().size()));
+ _id.c_str(), reply->getEntries().size()));
LOG(debug, "Visitor %s handling block of %zu documents.",
_id.c_str(),
reply->getEntries().size());
try {
framework::MilliSecTimer processingTimer(_component.getClock());
- handleDocuments(reply->getBucketId(),
- reply->getEntries(),
- *_hitCounter);
- metrics.averageProcessingTime[reply->getLoadType()]
- .addValue(processingTimer.getElapsedTimeAsDouble());
+ handleDocuments(reply->getBucketId(), reply->getEntries(), *_hitCounter);
+ metrics.averageProcessingTime.addValue(processingTimer.getElapsedTimeAsDouble());
MBUS_TRACE(reply->getTrace(), 5, "Done processing data block in visitor plugin");
@@ -1173,13 +1169,10 @@ Visitor::getIterators()
selection.setToTimestamp(
spi::Timestamp(_visitorOptions._toTime.getTime()));
- std::shared_ptr<CreateIteratorCommand> cmd(
- new CreateIteratorCommand(bucket,
- selection,
- _visitorOptions._fieldSet,
- _visitorOptions._visitRemoves ?
- spi::NEWEST_DOCUMENT_OR_REMOVE :
- spi::NEWEST_DOCUMENT_ONLY));
+ auto cmd = std::make_shared<CreateIteratorCommand>(bucket, selection,_visitorOptions._fieldSet,
+ _visitorOptions._visitRemoves
+ ? spi::NEWEST_DOCUMENT_OR_REMOVE
+ : spi::NEWEST_DOCUMENT_ONLY);
cmd->getTrace().setLevel(_traceLevel);
cmd->setPriority(_initiatingCmd->getPriority());
diff --git a/storage/src/vespa/storage/visiting/visitormanager.cpp b/storage/src/vespa/storage/visiting/visitormanager.cpp
index abe496ac770..53846075ead 100644
--- a/storage/src/vespa/storage/visiting/visitormanager.cpp
+++ b/storage/src/vespa/storage/visiting/visitormanager.cpp
@@ -171,15 +171,11 @@ VisitorManager::configure(std::unique_ptr<vespa::config::content::core::StorVisi
"No visitor threads configured. If you don't want visitors "
"to run, don't use visitormanager.", VESPA_STRLOC);
}
- _metrics->initThreads(config->visitorthreads, _component.getLoadTypes()->getMetricLoadTypes());
+ _metrics->initThreads(config->visitorthreads);
for (int32_t i=0; i<config->visitorthreads; ++i) {
- _visitorThread.push_back(std::make_pair(
- std::shared_ptr<VisitorThread>(
- new VisitorThread(i, _componentRegister,
- _messageSessionFactory,
- _visitorFactories,
- *_metrics->threads[i], *this)),
- std::map<api::VisitorId, std::string>()));
+ _visitorThread.emplace_back(
+ new VisitorThread(i, _componentRegister, _messageSessionFactory, _visitorFactories, *_metrics->threads[i], *this),
+ std::map<api::VisitorId, std::string>());
}
}
_maxFixedConcurrentVisitors = maxConcurrentVisitorsFixed;
diff --git a/storage/src/vespa/storage/visiting/visitormetrics.cpp b/storage/src/vespa/storage/visiting/visitormetrics.cpp
index 191f9fabc60..c35e0ab77ef 100644
--- a/storage/src/vespa/storage/visiting/visitormetrics.cpp
+++ b/storage/src/vespa/storage/visiting/visitormetrics.cpp
@@ -31,10 +31,10 @@ VisitorMetrics::VisitorMetrics()
queueSize.unsetOnZeroValue();
}
-VisitorMetrics::~VisitorMetrics() { }
+VisitorMetrics::~VisitorMetrics() = default;
void
-VisitorMetrics::initThreads(uint16_t threadCount, const metrics::LoadTypeSet& loadTypes) {
+VisitorMetrics::initThreads(uint16_t threadCount) {
if (!threads.empty()) {
throw vespalib::IllegalStateException("Cannot initialize visitor metrics twice", VESPA_STRLOC);
}
@@ -43,7 +43,7 @@ VisitorMetrics::initThreads(uint16_t threadCount, const metrics::LoadTypeSet& lo
for (uint32_t i=0; i<threads.size(); ++i) {
vespalib::asciistream ost;
ost << "visitor_thread_" << i;
- threads[i].reset(new VisitorThreadMetrics( ost.str(), ost.str(), loadTypes));
+ threads[i] = std::make_shared<VisitorThreadMetrics>( ost.str(), ost.str());
registerMetric(*threads[i]);
sum.addMetricToSum(*threads[i]);
}
diff --git a/storage/src/vespa/storage/visiting/visitormetrics.h b/storage/src/vespa/storage/visiting/visitormetrics.h
index f44cc6a7f61..52b29a3a234 100644
--- a/storage/src/vespa/storage/visiting/visitormetrics.h
+++ b/storage/src/vespa/storage/visiting/visitormetrics.h
@@ -1,16 +1,10 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/**
- * @class storage::VisitorMetrics
- * @ingroup visiting
- *
- * @brief Metrics for visiting.
- *
- * @version $Id$
- */
+
#pragma once
-#include <vespa/metrics/metrics.h>
#include "visitorthreadmetrics.h"
+#include <vespa/metrics/summetric.h>
+#include <vespa/metrics/countmetric.h>
namespace storage {
@@ -26,9 +20,9 @@ struct VisitorMetrics : public metrics::MetricSet
metrics::SumMetric<MetricSet> sum;
VisitorMetrics();
- ~VisitorMetrics();
+ ~VisitorMetrics() override;
- void initThreads(uint16_t threadCount, const metrics::LoadTypeSet& loadTypes);
+ void initThreads(uint16_t threadCount);
};
} // storage
diff --git a/storage/src/vespa/storage/visiting/visitorthread.cpp b/storage/src/vespa/storage/visiting/visitorthread.cpp
index 2839d3566aa..52943fde419 100644
--- a/storage/src/vespa/storage/visiting/visitorthread.cpp
+++ b/storage/src/vespa/storage/visiting/visitorthread.cpp
@@ -207,7 +207,7 @@ VisitorThread::run(framework::ThreadHandle& thread)
(entry._message->getType() != api::MessageType::INTERNAL
|| static_cast<api::InternalCommand&>(*entry._message).getType() != PropagateVisitorConfig::ID))
{
- entry._timer.stop(_metrics.averageQueueWaitingTime[entry._message->getLoadType()]);
+ entry._timer.stop(_metrics.averageQueueWaitingTime);
}
}
@@ -231,8 +231,7 @@ VisitorThread::run(framework::ThreadHandle& thread)
if (_currentlyRunningVisitor == _visitors.end()) {
handleNonExistingVisitorCall(entry, result);
} else {
- _currentlyRunningVisitor->second->handleDocumentApiReply(
- std::move(entry._mbusReply), _metrics);
+ _currentlyRunningVisitor->second->handleDocumentApiReply(std::move(entry._mbusReply), _metrics);
if (_currentlyRunningVisitor->second->isCompleted()) {
close();
}
@@ -250,7 +249,7 @@ VisitorThread::run(framework::ThreadHandle& thread)
result = ReturnCode(ReturnCode::INTERNAL_FAILURE, ost.str());
if (entry._message.get() && entry._message->getType() == api::MessageType::VISITOR_CREATE) {
_messageSender.closed(entry._visitorId);
- _metrics.failedVisitors[entry._message->getLoadType()].inc(1);
+ _metrics.failedVisitors.inc(1);
}
}
_currentlyRunningVisitor = _visitors.end();
@@ -291,16 +290,13 @@ VisitorThread::close()
Visitor& v = *_currentlyRunningVisitor->second;
- documentapi::LoadType loadType(v.getLoadType());
-
- _metrics.averageVisitorLifeTime[loadType].addValue(
- (closeTime - v.getStartTime()).getMillis().getTime());
+ _metrics.averageVisitorLifeTime.addValue((closeTime - v.getStartTime()).getMillis().getTime());
v.finalize();
_messageSender.closed(_currentlyRunningVisitor->first);
if (v.failed()) {
- _metrics.abortedVisitors[loadType].inc(1);
+ _metrics.abortedVisitors.inc(1);
} else {
- _metrics.completedVisitors[loadType].inc(1);
+ _metrics.completedVisitors.inc(1);
}
framework::SecondTime currentTime(_component.getClock().getTimeInSeconds());
trimRecentlyCompletedList(currentTime);
@@ -322,8 +318,7 @@ VisitorThread::trimRecentlyCompletedList(framework::SecondTime currentTime)
}
void
-VisitorThread::handleNonExistingVisitorCall(const Event& entry,
- ReturnCode& code)
+VisitorThread::handleNonExistingVisitorCall(const Event& entry, ReturnCode& code)
{
// Get current time. Set the time that is the oldest still recent.
framework::SecondTime currentTime(_component.getClock().getTimeInSeconds());
@@ -368,8 +363,7 @@ VisitorThread::createVisitor(vespalib::stringref libName,
}
try{
- std::shared_ptr<Visitor> visitor(it->second->makeVisitor(
- _component, *libIter->second, params));
+ std::shared_ptr<Visitor> visitor(it->second->makeVisitor(_component, *libIter->second, params));
if (!visitor.get()) {
error << "Factory function in '" << str << "' failed.";
}
@@ -530,8 +524,8 @@ VisitorThread::onCreateVisitor(
LOG(error, "Got exception we can't handle: %s", e.what());
assert(false);
}
- _metrics.createdVisitors[visitor->getLoadType()].inc(1);
- visitorTimer.stop(_metrics.averageVisitorCreationTime[visitor->getLoadType()]);
+ _metrics.createdVisitors.inc(1);
+ visitorTimer.stop(_metrics.averageVisitorCreationTime);
} else {
// Send reply
auto reply = std::make_shared<api::CreateVisitorReply>(*cmd);
diff --git a/storage/src/vespa/storage/visiting/visitorthread.h b/storage/src/vespa/storage/visiting/visitorthread.h
index a682544ec23..3dfe9571c1f 100644
--- a/storage/src/vespa/storage/visiting/visitorthread.h
+++ b/storage/src/vespa/storage/visiting/visitorthread.h
@@ -60,8 +60,7 @@ class VisitorThread : public framework::Runnable,
Event(const Event& other) = delete;
Event& operator= (const Event& other) = delete;
Event(api::VisitorId visitor, mbus::Reply::UP reply);
- Event(api::VisitorId visitor,
- const std::shared_ptr<api::StorageMessage>& msg);
+ Event(api::VisitorId visitor, const std::shared_ptr<api::StorageMessage>& msg);
~Event();
bool empty() const noexcept {
diff --git a/storage/src/vespa/storage/visiting/visitorthreadmetrics.cpp b/storage/src/vespa/storage/visiting/visitorthreadmetrics.cpp
new file mode 100644
index 00000000000..df58d14c81e
--- /dev/null
+++ b/storage/src/vespa/storage/visiting/visitorthreadmetrics.cpp
@@ -0,0 +1,27 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "visitorthreadmetrics.h"
+
+namespace storage {
+
+// TODO Vespa 8 all metrics with .sum in the name should have that removed.
+VisitorThreadMetrics::VisitorThreadMetrics(const std::string& name, const std::string& desc)
+ : metrics::MetricSet(name, {{"visitor"},{"partofsum"},{"thread"}}, desc),
+ queueSize("queuesize", {}, "Size of input message queue.", this),
+ averageQueueWaitingTime("averagequeuewait.sum", {}, "Average time an operation spends in input queue.", this),
+ averageVisitorLifeTime("averagevisitorlifetime.sum", {}, "Average lifetime of a visitor", this),
+ averageVisitorCreationTime("averagevisitorcreationtime", {}, "Average time spent creating a visitor instance", this),
+ averageMessageSendTime("averagemessagesendtime.sum", {}, "Average time it takes for messages to be sent to their target (and be replied to)", this),
+ averageProcessingTime("averageprocessingtime.sum", {}, "Average time visitor uses in handleDocuments() call", this),
+ createdVisitors("created.sum", {}, "Number of visitors created.", this),
+ abortedVisitors("aborted", {}, "Number of visitors aborted.", this),
+ completedVisitors("completed.sum", {}, "Number of visitors completed", this),
+ failedVisitors("failed.sum", {}, "Number of visitors failed", this),
+ visitorDestinationFailureReplies("destination_failure_replies", {},"Number of failure replies received from the visitor destination", this)
+{
+ queueSize.unsetOnZeroValue();
+}
+
+VisitorThreadMetrics::~VisitorThreadMetrics() = default;
+
+}
diff --git a/storage/src/vespa/storage/visiting/visitorthreadmetrics.h b/storage/src/vespa/storage/visiting/visitorthreadmetrics.h
index c21fe09cdb4..e58e1f01f59 100644
--- a/storage/src/vespa/storage/visiting/visitorthreadmetrics.h
+++ b/storage/src/vespa/storage/visiting/visitorthreadmetrics.h
@@ -1,108 +1,30 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/**
- * @class storage::VisitorThreadMetrics
- * @ingroup visiting
- *
- * @brief Metrics for the visitor threads.
- *
- * @version $Id$
- */
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/metrics/metricset.h>
namespace storage {
struct VisitorThreadMetrics : public metrics::MetricSet
{
- typedef metrics::DoubleAverageMetric DOUBLE;
- typedef metrics::LongAverageMetric COUNT;
-
- metrics::LongAverageMetric queueSize;
- metrics::LoadMetric<DOUBLE> averageQueueWaitingTime;
- metrics::LoadMetric<DOUBLE> averageVisitorLifeTime;
- metrics::LoadMetric<DOUBLE> averageVisitorCreationTime;
- metrics::LoadMetric<DOUBLE> averageMessageSendTime;
- metrics::LoadMetric<DOUBLE> averageProcessingTime;
- metrics::LoadMetric<COUNT> createdVisitors;
- metrics::LoadMetric<COUNT> abortedVisitors;
- metrics::LoadMetric<COUNT> completedVisitors;
- metrics::LoadMetric<COUNT> failedVisitors;
- metrics::LoadMetric<COUNT> visitorDestinationFailureReplies;
-
- VisitorThreadMetrics(const std::string& name,
- const std::string& desc,
- const metrics::LoadTypeSet& loadTypes)
- : metrics::MetricSet(name, {{"visitor"},{"partofsum"},{"thread"}}, desc),
- queueSize("queuesize", {},
- "Size of input message queue.", this),
- averageQueueWaitingTime(
- loadTypes,
- DOUBLE("averagequeuewait",
- {},
- "Average time an operation spends in input queue."),
- this),
- averageVisitorLifeTime(
- loadTypes,
- DOUBLE("averagevisitorlifetime",
- {},
- "Average lifetime of a visitor"),
- this),
- averageVisitorCreationTime(
- loadTypes,
- DOUBLE("averagevisitorcreationtime",
- {},
- "Average time spent creating a visitor instance"),
- this),
- averageMessageSendTime(
- loadTypes,
- DOUBLE("averagemessagesendtime",
- {},
- "Average time it takes for messages to be sent to "
- "their target (and be replied to)"),
- this),
- averageProcessingTime(
- loadTypes,
- DOUBLE("averageprocessingtime",
- {},
- "Average time visitor uses in handleDocuments() call"),
- this),
- createdVisitors(
- loadTypes,
- COUNT("created",
- {},
- "Number of visitors created."),
- this),
- abortedVisitors(
- loadTypes,
- COUNT("aborted",
- {},
- "Number of visitors aborted."),
- this),
- completedVisitors(
- loadTypes,
- COUNT("completed",
- {},
- "Number of visitors completed"),
- this),
- failedVisitors(
- loadTypes,
- COUNT("failed",
- {},
- "Number of visitors failed"),
- this),
- visitorDestinationFailureReplies(
- loadTypes,
- COUNT("destination_failure_replies",
- {},
- "Number of failure replies received from "
- "the visitor destination"),
- this)
- {
- queueSize.unsetOnZeroValue();
- }
-
+ using DoubleAverageMetric = metrics::DoubleAverageMetric;
+ using LongAverageMetric = metrics::LongAverageMetric;
+
+ LongAverageMetric queueSize;
+ DoubleAverageMetric averageQueueWaitingTime;
+ DoubleAverageMetric averageVisitorLifeTime;
+ DoubleAverageMetric averageVisitorCreationTime;
+ DoubleAverageMetric averageMessageSendTime;
+ DoubleAverageMetric averageProcessingTime;
+ LongAverageMetric createdVisitors;
+ LongAverageMetric abortedVisitors;
+ LongAverageMetric completedVisitors;
+ LongAverageMetric failedVisitors;
+ LongAverageMetric visitorDestinationFailureReplies;
+
+ VisitorThreadMetrics(const std::string& name, const std::string& desc);
+ ~VisitorThreadMetrics() override;
};
}
-