diff options
author | Geir Storli <geirst@oath.com> | 2018-09-25 11:13:34 +0000 |
---|---|---|
committer | gjoranv <gv@oath.com> | 2019-01-21 15:09:22 +0100 |
commit | 2a98f5c8cd0ae8114064f5e6c5ae1631d780daae (patch) | |
tree | da7edfdb1765213a7fb0067aaeee3a03d384406b /searchcore | |
parent | 94cbaa1e5dff6dcb2a8588b24e5e9a31cb4b796e (diff) |
Remove AttributeMetricsCollection and DocumentDBMetricsCollection as they are no longer needed.
Diffstat (limited to 'searchcore')
21 files changed, 101 insertions, 178 deletions
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index a2782437043..32cf0584768 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -7,8 +7,7 @@ #include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchcore/proton/initializer/task_runner.h> #include <vespa/searchcore/proton/metrics/attribute_metrics.h> -#include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h> -#include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h> +#include <vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h> #include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h> @@ -107,7 +106,7 @@ struct MyMetricsWireService : public DummyWireService { std::set<vespalib::string> _attributes; MyMetricsWireService() : _attributes() {} - virtual void addAttribute(const AttributeMetricsCollection &, const std::string &name) override { + virtual void addAttribute(AttributeMetrics &, const std::string &name) override { _attributes.insert(name); } }; @@ -141,7 +140,7 @@ struct MyStoreOnlyContext MySyncProxy _syncProxy; MyGetSerialNum _getSerialNum; MyFileHeaderContext _fileHeader; - DocumentDBMetricsCollection _metrics; + DocumentDBTaggedMetrics _metrics; std::mutex _configMutex; HwInfo _hwInfo; StoreOnlyContext _ctx; @@ -181,7 +180,6 @@ struct MyFastAccessContext { MyStoreOnlyContext _storeOnlyCtx; AttributeMetrics _attributeMetrics; - AttributeMetricsCollection _attributeMetricsCollection; MyMetricsWireService _wireService; FastAccessContext _ctx; MyFastAccessContext(IThreadingService &writeService, @@ -202,9 +200,8 @@ MyFastAccessContext::MyFastAccessContext(IThreadingService &writeService, Thread IBucketDBHandlerInitializer & bucketDBHandlerInitializer) : _storeOnlyCtx(writeService, summaryExecutor, bucketDB, bucketDBHandlerInitializer), _attributeMetrics(NULL), - _attributeMetricsCollection(_attributeMetrics), _wireService(), - _ctx(_storeOnlyCtx._ctx, _attributeMetricsCollection, _wireService) + _ctx(_storeOnlyCtx._ctx, _attributeMetrics, _wireService) {} MyFastAccessContext::~MyFastAccessContext() = default; diff --git a/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp b/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp index d3cd3f0d92e..c798de01804 100644 --- a/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp +++ b/searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp @@ -1,11 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/metrics/metricset.h> -#include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h> #include <vespa/searchcore/proton/metrics/attribute_metrics.h> -#include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h> - - #include <vespa/searchcore/proton/metrics/metrics_engine.h> #include <vespa/vespalib/testkit/testapp.h> @@ -28,13 +24,13 @@ struct AttributeMetricsFixture { metrics(&parent) {} void addAttribute(const vespalib::string &attrName) { - engine.addAttribute(AttributeMetricsCollection(metrics), attrName); + engine.addAttribute(metrics, attrName); } void removeAttribute(const vespalib::string &attrName) { - engine.removeAttribute(AttributeMetricsCollection(metrics), attrName); + engine.removeAttribute(metrics, attrName); } void cleanAttributes() { - engine.cleanAttributes(AttributeMetricsCollection(metrics)); + engine.cleanAttributes(metrics); } void assertRegisteredMetrics(size_t expNumMetrics) const { EXPECT_EQUAL(expNumMetrics, parent.getRegisteredMetrics().size()); diff --git a/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt index 9f9640a4a06..6077a6ddd87 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt @@ -4,7 +4,6 @@ vespa_add_library(searchcore_proton_metrics STATIC attribute_metrics.cpp content_proton_metrics.cpp documentdb_job_trackers.cpp - documentdb_metrics_collection.cpp documentdb_tagged_metrics.cpp executor_metrics.cpp executor_threading_service_metrics.cpp diff --git a/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics_collection.h b/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics_collection.h deleted file mode 100644 index 1a0fc333213..00000000000 --- a/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics_collection.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -namespace proton { - -class AttributeMetrics; - -/** - * A collection of references to all the metrics for a set of attributes. - */ -class AttributeMetricsCollection -{ -private: - AttributeMetrics &_metrics; - -public: - AttributeMetricsCollection(AttributeMetrics &metrics) - : _metrics(metrics) - { - } - AttributeMetrics &getMetrics() const { return _metrics; } -}; - -} - diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_metrics_collection.cpp b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_metrics_collection.cpp deleted file mode 100644 index a936530a346..00000000000 --- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_metrics_collection.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "documentdb_metrics_collection.h" - -namespace proton { - -DocumentDBMetricsCollection::DocumentDBMetricsCollection(const vespalib::string &docTypeName, size_t maxNumThreads) - : _taggedMetrics(docTypeName), - _maxNumThreads(maxNumThreads) -{} - -DocumentDBMetricsCollection::~DocumentDBMetricsCollection() = default; - -} - diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_metrics_collection.h b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_metrics_collection.h deleted file mode 100644 index 536007f5dfa..00000000000 --- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_metrics_collection.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include "documentdb_tagged_metrics.h" - -namespace proton { - -/** - * A collection of all the metrics for a document db (both tagged and no-tagged). - */ -class DocumentDBMetricsCollection -{ -private: - DocumentDBTaggedMetrics _taggedMetrics; - size_t _maxNumThreads; - -public: - DocumentDBMetricsCollection(const vespalib::string &docTypeName, size_t maxNumThreads); - ~DocumentDBMetricsCollection(); - DocumentDBTaggedMetrics &getTaggedMetrics() { return _taggedMetrics; } - size_t maxNumThreads() const { return _maxNumThreads; } -}; - -} - diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp index 13116f5a0ff..043d3b3314e 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp @@ -234,7 +234,7 @@ DocumentDBTaggedMetrics::DocumentsMetrics::DocumentsMetrics(metrics::MetricSet * DocumentDBTaggedMetrics::DocumentsMetrics::~DocumentsMetrics() = default; -DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docTypeName) +DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docTypeName, size_t maxNumThreads_) : MetricSet("documentdb", {{"documenttype", docTypeName}}, "Document DB metrics", nullptr), job(this), attribute(this), @@ -247,7 +247,8 @@ DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docType sessionCache(this), documents(this), totalMemoryUsage(this), - totalDiskUsage("disk_usage", {}, "The total disk usage (in bytes) for this document db", this) + totalDiskUsage("disk_usage", {}, "The total disk usage (in bytes) for this document db", this), + maxNumThreads(maxNumThreads_) { } diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h index 94a69be2c7f..bfb954ecd25 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h @@ -191,8 +191,9 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet DocumentsMetrics documents; MemoryUsageMetrics totalMemoryUsage; metrics::LongValueMetric totalDiskUsage; + size_t maxNumThreads; - DocumentDBTaggedMetrics(const vespalib::string &docTypeName); + DocumentDBTaggedMetrics(const vespalib::string &docTypeName, size_t maxNumThreads_); ~DocumentDBTaggedMetrics(); }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp index a9fdbf90b43..d34ec8d05a8 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp @@ -1,8 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include "attribute_metrics.h" +#include "documentdb_tagged_metrics.h" #include "metrics_engine.h" -#include "attribute_metrics_collection.h" -#include "documentdb_metrics_collection.h" #include <vespa/metrics/jsonwriter.h> #include <vespa/metrics/metricmanager.h> @@ -65,17 +65,17 @@ MetricsEngine::removeExternalMetrics(metrics::Metric &child) } void -MetricsEngine::addDocumentDBMetrics(DocumentDBMetricsCollection &child) +MetricsEngine::addDocumentDBMetrics(DocumentDBTaggedMetrics &child) { metrics::MetricLockGuard guard(_manager->getMetricLock()); - _root.registerMetric(child.getTaggedMetrics()); + _root.registerMetric(child); } void -MetricsEngine::removeDocumentDBMetrics(DocumentDBMetricsCollection &child) +MetricsEngine::removeDocumentDBMetrics(DocumentDBTaggedMetrics &child) { metrics::MetricLockGuard guard(_manager->getMetricLock()); - _root.unregisterMetric(child.getTaggedMetrics()); + _root.unregisterMetric(child); } namespace { @@ -114,26 +114,26 @@ doCleanAttributes(AttributeMetrics &attributes) } void -MetricsEngine::addAttribute(const AttributeMetricsCollection &subAttributes, +MetricsEngine::addAttribute(AttributeMetrics &subAttributes, const std::string &name) { metrics::MetricLockGuard guard(_manager->getMetricLock()); - doAddAttribute(subAttributes.getMetrics(), name); + doAddAttribute(subAttributes, name); } void -MetricsEngine::removeAttribute(const AttributeMetricsCollection &subAttributes, +MetricsEngine::removeAttribute(AttributeMetrics &subAttributes, const std::string &name) { metrics::MetricLockGuard guard(_manager->getMetricLock()); - doRemoveAttribute(subAttributes.getMetrics(), name); + doRemoveAttribute(subAttributes, name); } void -MetricsEngine::cleanAttributes(const AttributeMetricsCollection &subAttributes) +MetricsEngine::cleanAttributes(AttributeMetrics &subAttributes) { metrics::MetricLockGuard guard(_manager->getMetricLock()); - doCleanAttributes(subAttributes.getMetrics()); + doCleanAttributes(subAttributes); } namespace { @@ -165,17 +165,17 @@ cleanRankProfilesIn(MatchingMetricsType &matchingMetrics) } void -MetricsEngine::addRankProfile(DocumentDBMetricsCollection &owner, const std::string &name, size_t numDocIdPartitions) +MetricsEngine::addRankProfile(DocumentDBTaggedMetrics &owner, const std::string &name, size_t numDocIdPartitions) { metrics::MetricLockGuard guard(_manager->getMetricLock()); - size_t adjustedNumDocIdPartitions = std::min(numDocIdPartitions, owner.maxNumThreads()); - addRankProfileTo(owner.getTaggedMetrics().matching, name, adjustedNumDocIdPartitions); + size_t adjustedNumDocIdPartitions = std::min(numDocIdPartitions, owner.maxNumThreads); + addRankProfileTo(owner.matching, name, adjustedNumDocIdPartitions); } void -MetricsEngine::cleanRankProfiles(DocumentDBMetricsCollection &owner) { +MetricsEngine::cleanRankProfiles(DocumentDBTaggedMetrics &owner) { metrics::MetricLockGuard guard(_manager->getMetricLock()); - cleanRankProfilesIn(owner.getTaggedMetrics().matching); + cleanRankProfilesIn(owner.matching); } void @@ -184,4 +184,4 @@ MetricsEngine::stop() _manager->stop(); } -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h index ec42e0c56c7..dc8872c6c8b 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h @@ -16,7 +16,8 @@ namespace config { } namespace proton { -class DocumentDBMetricsCollection; +class AttributeMetrics; +class DocumentDBTaggedMetrics; class MetricsEngine : public MetricsWireService { @@ -36,15 +37,15 @@ public: void removeMetricsHook(metrics::UpdateHook &hook); void addExternalMetrics(metrics::Metric &child); void removeExternalMetrics(metrics::Metric &child); - void addDocumentDBMetrics(DocumentDBMetricsCollection &child); - void removeDocumentDBMetrics(DocumentDBMetricsCollection &child); - void addAttribute(const AttributeMetricsCollection &subAttributes, + void addDocumentDBMetrics(DocumentDBTaggedMetrics &child); + void removeDocumentDBMetrics(DocumentDBTaggedMetrics &child); + void addAttribute(AttributeMetrics &subAttributes, const std::string &name) override; - void removeAttribute(const AttributeMetricsCollection &subAttributes, + void removeAttribute(AttributeMetrics &subAttributes, const std::string &name) override; - void cleanAttributes(const AttributeMetricsCollection &subAttributes) override; - void addRankProfile(DocumentDBMetricsCollection &owner, const std::string &name, size_t numDocIdPartitions) override; - void cleanRankProfiles(DocumentDBMetricsCollection &owner) override; + void cleanAttributes(AttributeMetrics &subAttributes) override; + void addRankProfile(DocumentDBTaggedMetrics &owner, const std::string &name, size_t numDocIdPartitions) override; + void cleanRankProfiles(DocumentDBTaggedMetrics &owner) override; void stop(); vespalib::MetricsProducer &metrics_producer() { return _metrics_producer; } diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metricswireservice.h b/searchcore/src/vespa/searchcore/proton/metrics/metricswireservice.h index ca3b2e7bdbc..70602adbd7b 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/metricswireservice.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/metricswireservice.h @@ -5,29 +5,29 @@ #include <string> namespace proton { -class AttributeMetricsCollection; -class DocumentDBMetricsCollection; -class LegacyAttributeMetrics; + +class AttributeMetrics; +class DocumentDBTaggedMetrics; struct MetricsWireService { - virtual void addAttribute(const AttributeMetricsCollection &subAttributes, + virtual void addAttribute(AttributeMetrics &subAttributes, const std::string &name) = 0; - virtual void removeAttribute(const AttributeMetricsCollection &subAttributes, + virtual void removeAttribute(AttributeMetrics &subAttributes, const std::string &name) = 0; - virtual void cleanAttributes(const AttributeMetricsCollection &subAttributes) = 0; - virtual void addRankProfile(DocumentDBMetricsCollection &owner, + virtual void cleanAttributes(AttributeMetrics &subAttributes) = 0; + virtual void addRankProfile(DocumentDBTaggedMetrics &owner, const std::string &name, size_t numDocIdPartitions) = 0; - virtual void cleanRankProfiles(DocumentDBMetricsCollection &owner) = 0; + virtual void cleanRankProfiles(DocumentDBTaggedMetrics &owner) = 0; virtual ~MetricsWireService() {} }; struct DummyWireService : public MetricsWireService { - virtual void addAttribute(const AttributeMetricsCollection &, const std::string &) override {} - virtual void removeAttribute(const AttributeMetricsCollection &, const std::string &) override {} - virtual void cleanAttributes(const AttributeMetricsCollection &) override {} - virtual void addRankProfile(DocumentDBMetricsCollection &, const std::string &, size_t) override {} - virtual void cleanRankProfiles(DocumentDBMetricsCollection &) override {} + virtual void addAttribute(AttributeMetrics &, const std::string &) override {} + virtual void removeAttribute(AttributeMetrics &, const std::string &) override {} + virtual void cleanAttributes(AttributeMetrics &) override {} + virtual void addRankProfile(DocumentDBTaggedMetrics &, const std::string &, size_t) override {} + virtual void cleanRankProfiles(DocumentDBTaggedMetrics &) override {} }; } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 4540a864eac..6a1d053745f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -20,7 +20,6 @@ #include <vespa/searchcore/proton/feedoperation/noopoperation.h> #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/initializer/task_runner.h> -#include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h> #include <vespa/searchcore/proton/reference/i_document_db_reference_registry.h> @@ -155,7 +154,7 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, _writeFilter(), _feedHandler(_writeService, tlsSpec, docTypeName, _state, *this, _writeFilter, *this, tlsDirectWriter), _subDBs(*this, *this, _feedHandler, _docTypeName, _writeService, warmupExecutor, - sharedExecutor, fileHeaderContext, metricsWireService, getMetricsCollection(), + sharedExecutor, fileHeaderContext, metricsWireService, getMetrics(), queryLimiter, clock, _configMutex, _baseDir, makeSubDBConfig(protonCfg), hwInfo), _maintenanceController(_writeService.master(), sharedExecutor, _docTypeName), _visibility(_feedHandler, _writeService, _feedView), @@ -547,11 +546,9 @@ DocumentDB::close() stopMaintenance(); // The attributes in the ready sub db is also the total set of attributes. - DocumentDBTaggedMetrics &metrics = getMetricsCollection().getTaggedMetrics(); - AttributeMetricsCollection ready(metrics.ready.attributes); - AttributeMetricsCollection notReady(metrics.notReady.attributes); - _metricsWireService.cleanAttributes(ready); - _metricsWireService.cleanAttributes(notReady); + DocumentDBTaggedMetrics &metrics = getMetrics(); + _metricsWireService.cleanAttributes(metrics.ready.attributes); + _metricsWireService.cleanAttributes(metrics.notReady.attributes); _writeService.sync(); masterExecute([this] () { closeSubDBs(); } ); _writeService.sync(); @@ -1029,7 +1026,7 @@ DocumentDB::notifyAllBucketsChanged() } void -DocumentDB::updateMetrics(DocumentDBMetricsCollection &metrics) +DocumentDB::updateMetrics(DocumentDBTaggedMetrics &metrics) { if (_state.getState() < DDBState::State::REPLAY_TRANSACTION_LOG) { return; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index f9b4e5ad1f6..716a1058348 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -26,7 +26,7 @@ #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcore/proton/common/monitored_refcount.h> #include <vespa/searchcore/proton/metrics/documentdb_job_trackers.h> -#include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h> +#include <vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h> #include <vespa/searchcore/proton/persistenceengine/bucket_guard.h> #include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> #include <vespa/searchcore/proton/index/indexmanager.h> @@ -66,7 +66,7 @@ class DocumentDB : public DocumentDBConfigOwner, { private: class MetricsUpdateHook : public metrics::UpdateHook { - DocumentDBMetricsCollection _metrics; + DocumentDBTaggedMetrics _metrics; DocumentDB &_db; public: MetricsUpdateHook(DocumentDB &s, const std::string &doc_type, size_t maxNumThreads) @@ -74,7 +74,7 @@ private: _metrics(doc_type, maxNumThreads), _db(s) {} void updateMetrics(const MetricLockGuard & ) override { _db.updateMetrics(_metrics); } - DocumentDBMetricsCollection &getMetrics() { return _metrics; } + DocumentDBTaggedMetrics &getMetrics() { return _metrics; } }; struct DocumentStoreCacheStats { @@ -289,11 +289,11 @@ public: void close(); /** - * Obtain the metrics collection for this document db. + * Obtain the metrics for this document db. * * @return document db metrics **/ - DocumentDBMetricsCollection &getMetricsCollection() { return _metricsHook.getMetrics(); } + DocumentDBTaggedMetrics &getMetrics() { return _metricsHook.getMetrics(); } /** * Obtain the metrics update hook for this document db. @@ -424,7 +424,7 @@ public: * the metric manager). Do not call this function in multiple * threads at once. **/ - void updateMetrics(DocumentDBMetricsCollection &metrics); + void updateMetrics(DocumentDBTaggedMetrics &metrics); /** * Implement search::transactionlog::SyncProxy API. diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp index 88220f7aaf0..e01fb048266 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp @@ -13,7 +13,6 @@ #include <vespa/searchcore/proton/matching/matching_stats.h> #include <vespa/searchcore/proton/matching/matching_stats.h> #include <vespa/searchcore/proton/metrics/documentdb_job_trackers.h> -#include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h> #include <vespa/searchcore/proton/metrics/executor_threading_service_stats.h> #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/docstore/cachestats.h> @@ -71,9 +70,9 @@ updateDiskUsageMetric(metrics::LongValueMetric &metric, uint64_t diskUsage, Tota } void -updateIndexMetrics(DocumentDBMetricsCollection &metrics, const search::SearchableStats &stats, TotalStats &totalStats) +updateIndexMetrics(DocumentDBTaggedMetrics &metrics, const search::SearchableStats &stats, TotalStats &totalStats) { - DocumentDBTaggedMetrics::IndexMetrics &indexMetrics = metrics.getTaggedMetrics().index; + DocumentDBTaggedMetrics::IndexMetrics &indexMetrics = metrics.index; updateDiskUsageMetric(indexMetrics.diskUsage, stats.sizeOnDisk(), totalStats); updateMemoryUsageMetrics(indexMetrics.memoryUsage, stats.memoryUsage(), totalStats); indexMetrics.docsInMemory.set(stats.docsInMemory()); @@ -159,43 +158,43 @@ updateAttributeMetrics(AttributeMetrics &metrics, const TempAttributeMetrics &tm } void -updateAttributeMetrics(DocumentDBMetricsCollection &metrics, const DocumentSubDBCollection &subDbs, TotalStats &totalStats) +updateAttributeMetrics(DocumentDBTaggedMetrics &metrics, const DocumentSubDBCollection &subDbs, TotalStats &totalStats) { TempAttributeMetrics totalMetrics; TempAttributeMetrics readyMetrics; TempAttributeMetrics notReadyMetrics; fillTempAttributeMetrics(totalMetrics, readyMetrics, notReadyMetrics, subDbs); - updateAttributeMetrics(metrics.getTaggedMetrics().ready.attributes, readyMetrics); - updateAttributeMetrics(metrics.getTaggedMetrics().notReady.attributes, notReadyMetrics); - updateMemoryUsageMetrics(metrics.getTaggedMetrics().attribute.totalMemoryUsage, totalMetrics.total.memoryUsage, totalStats); + updateAttributeMetrics(metrics.ready.attributes, readyMetrics); + updateAttributeMetrics(metrics.notReady.attributes, notReadyMetrics); + updateMemoryUsageMetrics(metrics.attribute.totalMemoryUsage, totalMetrics.total.memoryUsage, totalStats); } void -updateMatchingMetrics(DocumentDBMetricsCollection &metrics, const IDocumentSubDB &ready) +updateMatchingMetrics(DocumentDBTaggedMetrics &metrics, const IDocumentSubDB &ready) { MatchingStats totalStats; - for (const auto &rankProfile : metrics.getTaggedMetrics().matching.rank_profiles) { + for (const auto &rankProfile : metrics.matching.rank_profiles) { MatchingStats matchingStats = ready.getMatcherStats(rankProfile.first); rankProfile.second->update(matchingStats); totalStats.add(matchingStats); } - metrics.getTaggedMetrics().matching.update(totalStats); + metrics.matching.update(totalStats); } void -updateSessionCacheMetrics(DocumentDBMetricsCollection &metrics, proton::matching::SessionManager &sessionManager) +updateSessionCacheMetrics(DocumentDBTaggedMetrics &metrics, proton::matching::SessionManager &sessionManager) { auto searchStats = sessionManager.getSearchStats(); - metrics.getTaggedMetrics().sessionCache.search.update(searchStats); + metrics.sessionCache.search.update(searchStats); auto groupingStats = sessionManager.getGroupingStats(); - metrics.getTaggedMetrics().sessionCache.grouping.update(groupingStats); + metrics.sessionCache.grouping.update(groupingStats); } void -updateDocumentsMetrics(DocumentDBMetricsCollection &metrics, const DocumentSubDBCollection &subDbs) +updateDocumentsMetrics(DocumentDBTaggedMetrics &metrics, const DocumentSubDBCollection &subDbs) { DocumentMetaStoreReadGuards dms(subDbs); uint32_t active = dms.numActiveDocs(); @@ -203,7 +202,7 @@ updateDocumentsMetrics(DocumentDBMetricsCollection &metrics, const DocumentSubDB uint32_t total = dms.numTotalDocs(); uint32_t removed = dms.numRemovedDocs(); - auto &docsMetrics = metrics.getTaggedMetrics().documents; + auto &docsMetrics = metrics.documents; docsMetrics.active.set(active); docsMetrics.ready.set(ready); docsMetrics.total.set(total); @@ -286,7 +285,7 @@ updateLidSpaceMetrics(MetricSetType &metrics, const search::IDocumentMetaStore & } void -DocumentDBMetricsUpdater::updateMetrics(DocumentDBMetricsCollection &metrics) +DocumentDBMetricsUpdater::updateMetrics(DocumentDBTaggedMetrics &metrics) { TotalStats totalStats; ExecutorThreadingServiceStats threadingServiceStats = _writeService.getStats(); @@ -295,11 +294,11 @@ DocumentDBMetricsUpdater::updateMetrics(DocumentDBMetricsCollection &metrics) updateMatchingMetrics(metrics, *_subDBs.getReadySubDB()); updateSessionCacheMetrics(metrics, _sessionManager); updateDocumentsMetrics(metrics, _subDBs); - updateDocumentStoreMetrics(metrics.getTaggedMetrics(), _subDBs, _lastDocStoreCacheStats, totalStats); - updateMiscMetrics(metrics.getTaggedMetrics(), threadingServiceStats); + updateDocumentStoreMetrics(metrics, _subDBs, _lastDocStoreCacheStats, totalStats); + updateMiscMetrics(metrics, threadingServiceStats); - metrics.getTaggedMetrics().totalMemoryUsage.update(totalStats.memoryUsage); - metrics.getTaggedMetrics().totalDiskUsage.set(totalStats.diskUsage); + metrics.totalMemoryUsage.update(totalStats.memoryUsage); + metrics.totalDiskUsage.set(totalStats.diskUsage); } void diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h index 2cf9e97e190..7c27b273c59 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h @@ -11,11 +11,9 @@ namespace matching { class SessionManager; } class AttributeUsageFilter; class DDBState; class DocumentDBJobTrackers; -class DocumentDBMetricsCollection; class DocumentSubDBCollection; class ExecutorThreadingService; class ExecutorThreadingServiceStats; -class LegacyDocumentDBMetrics; /** * Class used to update metrics for a document db. @@ -52,7 +50,7 @@ public: const DDBState &state); ~DocumentDBMetricsUpdater(); - void updateMetrics(DocumentDBMetricsCollection &metrics); + void updateMetrics(DocumentDBTaggedMetrics &metrics); }; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index 037abf4a85d..22b50a65a41 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -7,8 +7,7 @@ #include "i_document_subdb_owner.h" #include "maintenancecontroller.h" #include "searchabledocsubdb.h" - -#include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h> +#include <vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h> using proton::matching::SessionManager; using search::GrowStrategy; @@ -37,7 +36,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( vespalib::ThreadStackExecutorBase &sharedExecutor, const search::common::FileHeaderContext &fileHeaderContext, MetricsWireService &metricsWireService, - DocumentDBMetricsCollection &metrics, + DocumentDBTaggedMetrics &metrics, matching::QueryLimiter &queryLimiter, const vespalib::Clock &clock, std::mutex &configMutex, @@ -76,7 +75,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( cfg.getNumSearchThreads()), SearchableDocSubDB::Context(FastAccessDocSubDB::Context (context, - AttributeMetricsCollection(metrics.getTaggedMetrics().ready.attributes), + metrics.ready.attributes, metricsWireService), queryLimiter, clock, @@ -103,7 +102,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( true, true), FastAccessDocSubDB::Context(context, - AttributeMetricsCollection(metrics.getTaggedMetrics().notReady.attributes), + metrics.notReady.attributes, metricsWireService))); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index c4ddd6d0e72..68f790307ce 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -26,7 +26,7 @@ namespace searchcorespi { namespace proton { class DocumentDBConfig; -class DocumentDBMetricsCollection; +class DocumentDBTaggedMetrics; class MaintenanceController; class MetricsWireService; class ICommitable; @@ -102,7 +102,7 @@ public: vespalib::ThreadStackExecutorBase &sharedExecutor, const search::common::FileHeaderContext &fileHeaderContext, MetricsWireService &metricsWireService, - DocumentDBMetricsCollection &metrics, + DocumentDBTaggedMetrics &metrics, matching::QueryLimiter & queryLimiter, const vespalib::Clock &clock, std::mutex &configMutex, diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h index 461d1c3d18a..972c496508a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h @@ -5,7 +5,7 @@ #include "storeonlydocsubdb.h" #include <vespa/searchcore/proton/attribute/attributemanager.h> #include <vespa/searchcore/proton/common/docid_limit.h> -#include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h> +#include <vespa/searchcore/proton/metrics/attribute_metrics.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> namespace proton { @@ -45,10 +45,10 @@ public: struct Context { const StoreOnlyDocSubDB::Context _storeOnlyCtx; - const AttributeMetricsCollection &_subAttributeMetrics; + const AttributeMetrics &_subAttributeMetrics; MetricsWireService &_metricsWireService; Context(const StoreOnlyDocSubDB::Context &storeOnlyCtx, - const AttributeMetricsCollection &subAttributeMetrics, + const AttributeMetrics &subAttributeMetrics, MetricsWireService &metricsWireService) : _storeOnlyCtx(storeOnlyCtx), _subAttributeMetrics(subAttributeMetrics), @@ -64,7 +64,7 @@ private: const bool _fastAccessAttributesOnly; AttributeManager::SP _initAttrMgr; Configurer::FeedViewVarHolder _fastAccessFeedView; - AttributeMetricsCollection _subAttributeMetrics; + AttributeMetrics _subAttributeMetrics; std::shared_ptr<initializer::InitializerTask> createAttributeManagerInitializer(const DocumentDBConfig &configSnapshot, diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index f29fa3b7f6c..09e5a64185a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -541,7 +541,7 @@ Proton::addDocumentDB(const document::DocumentType &docType, if (!_isInitializing || _initDocumentDbsInSequence) { ret->waitForOnlineState(); } - _metricsEngine->addDocumentDBMetrics(ret->getMetricsCollection()); + _metricsEngine->addDocumentDBMetrics(ret->getMetrics()); _metricsEngine->addMetricsHook(ret->getMetricsUpdateHook()); _documentDBMap[docTypeName] = ret; if (_persistenceEngine) { @@ -597,7 +597,7 @@ Proton::removeDocumentDB(const DocTypeName &docTypeName) _summaryEngine->removeSearchHandler(docTypeName); _flushEngine->removeFlushHandler(docTypeName); _metricsEngine->removeMetricsHook(old->getMetricsUpdateHook()); - _metricsEngine->removeDocumentDBMetrics(old->getMetricsCollection()); + _metricsEngine->removeDocumentDBMetrics(old->getMetrics()); _diskMemUsageSampler->notifier().removeDiskMemUsageListener(old->diskMemUsageListener()); // Caller should have removed & drained relevant timer tasks old->close(); diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index b222aab1397..99186f89c6d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -17,7 +17,7 @@ #include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h> #include <vespa/searchcore/proton/flushengine/threadedflushtarget.h> #include <vespa/searchcore/proton/index/index_writer.h> -#include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h> +#include <vespa/searchcore/proton/matching/sessionmanager.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h> #include <vespa/searchlib/attribute/configconverter.h> @@ -80,7 +80,7 @@ StoreOnlyDocSubDB::Context::Context(IDocumentSubDBOwner &owner, vespalib::ThreadStackExecutorBase &sharedExecutor, std::shared_ptr<BucketDBOwner> bucketDB, bucketdb::IBucketDBHandlerInitializer & bucketDBHandlerInitializer, - DocumentDBMetricsCollection &metrics, + DocumentDBTaggedMetrics &metrics, std::mutex &configMutex, const HwInfo &hwInfo) : _owner(owner), diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index db9cbf7415a..d377166226e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -23,7 +23,7 @@ namespace proton { -class DocumentDBMetricsCollection; +class DocumentDBTaggedMetrics; class DocumentMetaStoreInitializerResult; class FeedHandler; class IDocumentSubDBOwner; @@ -113,7 +113,7 @@ public: vespalib::ThreadStackExecutorBase &_sharedExecutor; std::shared_ptr<BucketDBOwner> _bucketDB; bucketdb::IBucketDBHandlerInitializer &_bucketDBHandlerInitializer; - DocumentDBMetricsCollection &_metrics; + DocumentDBTaggedMetrics &_metrics; std::mutex &_configMutex; const HwInfo &_hwInfo; @@ -126,7 +126,7 @@ public: std::shared_ptr<BucketDBOwner> bucketDB, bucketdb::IBucketDBHandlerInitializer & bucketDBHandlerInitializer, - DocumentDBMetricsCollection &metrics, + DocumentDBTaggedMetrics &metrics, std::mutex &configMutex, const HwInfo &hwInfo); ~Context(); @@ -154,7 +154,7 @@ private: protected: searchcorespi::index::IThreadingService &_writeService; vespalib::ThreadStackExecutorBase &_sharedExecutor; - DocumentDBMetricsCollection &_metrics; + DocumentDBTaggedMetrics &_metrics; vespalib::VarHolder<ISearchHandler::SP> _iSearchView; vespalib::VarHolder<IFeedView::SP> _iFeedView; std::mutex &_configMutex; |