summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-10-27 14:26:38 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-10-27 14:44:02 +0200
commitc841fb59e808b76939dfed1a192b9efd0b463550 (patch)
treec1b912ce64e59f3212107100606c69892d436bbc /searchcore
parent5fcbb66f52d44b286f0898ab318f7e6269330f4e (diff)
Minor code maintenance while waiting for build to complete.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/metrics/metrics_engine/metrics_engine_test.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp21
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h29
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp15
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h11
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.h17
11 files changed, 54 insertions, 67 deletions
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 b50fcd083bc..1aaeb1707b3 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,14 +1,18 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Unit tests for metrics_engine.
-#include <vespa/log/log.h>
-LOG_SETUP("metrics_engine_test");
-
#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>
+#include <vespa/log/log.h>
+LOG_SETUP("metrics_engine_test");
+
using namespace proton;
struct DummyMetricSet : public metrics::MetricSet {
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp
index ce9828a8a23..c5296aa3b1f 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp
@@ -20,6 +20,6 @@ ExecutorMetrics::ExecutorMetrics(const std::string &name, metrics::MetricSet *pa
{
}
-ExecutorMetrics::~ExecutorMetrics() {}
+ExecutorMetrics::~ExecutorMetrics() = default;
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h
index 6462264ac11..a347edffd4b 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h
@@ -2,7 +2,9 @@
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/countmetric.h>
+#include <vespa/metrics/valuemetric.h>
#include <vespa/vespalib/util/threadstackexecutorbase.h>
namespace proton {
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp
index 2eaabe59569..25dfb3d71ab 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp
@@ -61,7 +61,7 @@ LegacyAttributeMetrics::List::List(metrics::MetricSet *parent)
{
}
-LegacyAttributeMetrics::List::~List() {}
+LegacyAttributeMetrics::List::~List() = default;
LegacyAttributeMetrics::LegacyAttributeMetrics(metrics::MetricSet *parent)
: metrics::MetricSet("attributes", "", "Attribute metrics", parent),
@@ -71,6 +71,6 @@ LegacyAttributeMetrics::LegacyAttributeMetrics(metrics::MetricSet *parent)
{
}
-LegacyAttributeMetrics::~LegacyAttributeMetrics() {}
+LegacyAttributeMetrics::~LegacyAttributeMetrics() = default;
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h
index bddb1a6a64e..073acabf614 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h
@@ -2,7 +2,9 @@
#pragma once
-#include <vespa/metrics/metrics.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/valuemetric.h>
+#include <map>
namespace proton {
@@ -27,7 +29,7 @@ struct LegacyAttributeMetrics : metrics::MetricSet {
// per attribute metrics will be wired in here (by the metrics engine)
List(metrics::MetricSet *parent);
- ~List();
+ ~List() override;
private:
std::map<std::string, Entry::UP> metrics;
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h
index 0abad83a3a6..2c66428aabd 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h
@@ -4,8 +4,8 @@
#include "legacy_attribute_metrics.h"
#include "executor_metrics.h"
-#include <vespa/metrics/metrics.h>
#include "sessionmanager_metrics.h"
+#include <vespa/metrics/summetric.h>
#include <vespa/searchcore/proton/matching/matching_stats.h>
namespace proton {
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp
index 13ce39ad755..94414e99c05 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp
@@ -2,6 +2,7 @@
#include "metrics_engine.h"
#include "attribute_metrics_collection.h"
+#include "documentdb_metrics_collection.h"
#include <vespa/metrics/jsonwriter.h>
#include <vespa/metrics/metricmanager.h>
@@ -15,12 +16,9 @@ MetricsEngine::MetricsEngine()
_legacyRoot(),
_manager(std::make_unique<metrics::MetricManager>()),
_metrics_producer(*_manager)
-{
-}
+{ }
-MetricsEngine::~MetricsEngine()
-{
-}
+MetricsEngine::~MetricsEngine() = default;
void
MetricsEngine::start(const config::ConfigUri &)
@@ -236,9 +234,8 @@ MetricsEngine::cleanAttributes(const AttributeMetricsCollection &subAttributes,
}
}
-void MetricsEngine::addRankProfile(LegacyDocumentDBMetrics &owner,
- const std::string &name,
- size_t numDocIdPartitions) {
+void
+MetricsEngine::addRankProfile(LegacyDocumentDBMetrics &owner, const std::string &name, size_t numDocIdPartitions) {
metrics::MetricLockGuard guard(_manager->getMetricLock());
auto &entry = owner.matching.rank_profiles[name];
if (entry.get()) {
@@ -250,13 +247,13 @@ void MetricsEngine::addRankProfile(LegacyDocumentDBMetrics &owner,
}
}
-void MetricsEngine::cleanRankProfiles(LegacyDocumentDBMetrics &owner) {
+void
+MetricsEngine::cleanRankProfiles(LegacyDocumentDBMetrics &owner) {
metrics::MetricLockGuard guard(_manager->getMetricLock());
LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMap metrics;
owner.matching.rank_profiles.swap(metrics);
- for (LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMap::const_iterator
- it = metrics.begin(); it != metrics.end(); ++it) {
- owner.matching.unregisterMetric(*it->second);
+ for (auto & metric : metrics) {
+ owner.matching.unregisterMetric(*metric.second);
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h
index a306b33bcdd..83d04cccef0 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h
@@ -3,14 +3,9 @@
#pragma once
#include "content_proton_metrics.h"
-#include "documentdb_metrics_collection.h"
#include "legacy_proton_metrics.h"
#include "metricswireservice.h"
-#include <algorithm>
-#include <vespa/fastlib/net/httpserver.h>
-#include <vespa/metrics/metrics.h>
#include <vespa/metrics/state_api_adapter.h>
-#include <vespa/vespalib/net/metrics_producer.h>
namespace metrics {
class Metricmanager;
@@ -22,6 +17,8 @@ namespace config {
}
namespace proton {
+class DocumentDBMetricsCollection;
+
class MetricsEngine : public MetricsWireService
{
private:
@@ -44,18 +41,16 @@ public:
void removeExternalMetrics(metrics::Metric &child);
void addDocumentDBMetrics(DocumentDBMetricsCollection &child);
void removeDocumentDBMetrics(DocumentDBMetricsCollection &child);
- virtual void addAttribute(const AttributeMetricsCollection &subAttributes,
- LegacyAttributeMetrics *totalAttributes,
- const std::string &name) override;
- virtual void removeAttribute(const AttributeMetricsCollection &subAttributes,
- LegacyAttributeMetrics *totalAttributes,
- const std::string &name) override;
- virtual void cleanAttributes(const AttributeMetricsCollection &subAttributes,
- LegacyAttributeMetrics *totalAttributes) override;
- virtual void addRankProfile(LegacyDocumentDBMetrics &owner,
- const std::string &name,
- size_t numDocIdPartitions) override;
- virtual void cleanRankProfiles(LegacyDocumentDBMetrics &owner) override;
+ void addAttribute(const AttributeMetricsCollection &subAttributes,
+ LegacyAttributeMetrics *totalAttributes,
+ const std::string &name) override;
+ void removeAttribute(const AttributeMetricsCollection &subAttributes,
+ LegacyAttributeMetrics *totalAttributes,
+ const std::string &name) override;
+ void cleanAttributes(const AttributeMetricsCollection &subAttributes,
+ LegacyAttributeMetrics *totalAttributes) override;
+ void addRankProfile(LegacyDocumentDBMetrics &owner, const std::string &name, size_t numDocIdPartitions) override;
+ void cleanRankProfiles(LegacyDocumentDBMetrics &owner) override;
void stop();
vespalib::MetricsProducer &metrics_producer() { return _metrics_producer; }
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
index acad6150ef8..f609b850876 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
@@ -2,13 +2,10 @@
#include "sessionmanager_metrics.h"
-namespace search {
-namespace grouping {
+namespace search::grouping {
SessionManagerMetrics::SessionManagerMetrics(metrics::MetricSet *parent)
- : metrics::MetricSet("sessionmanager", "",
- "Grouping session manager metrics",
- parent),
+ : metrics::MetricSet("sessionmanager", "", "Grouping session manager metrics", parent),
numInsert("numinsert", "", "Number of inserted sessions", this),
numPick("numpick", "", "Number if picked sessions", this),
numDropped("numdropped", "", "Number of dropped cached sessions", this),
@@ -17,11 +14,10 @@ SessionManagerMetrics::SessionManagerMetrics(metrics::MetricSet *parent)
{
}
-SessionManagerMetrics::~SessionManagerMetrics() {}
+SessionManagerMetrics::~SessionManagerMetrics() = default;
void
-SessionManagerMetrics::update(
- const proton::matching::SessionManager::Stats &stats)
+SessionManagerMetrics::update(const proton::matching::SessionManager::Stats &stats)
{
numInsert.inc(stats.numInsert);
numPick.inc(stats.numPick);
@@ -31,5 +27,4 @@ SessionManagerMetrics::update(
}
-} // namespace grouping
-} // namespace search
+}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
index 2ee8deb4082..37e070c9e04 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
@@ -2,11 +2,12 @@
#pragma once
-#include <vespa/metrics/metrics.h>
#include <vespa/searchcore/proton/matching/sessionmanager.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/countmetric.h>
+#include <vespa/metrics/valuemetric.h>
-namespace search {
-namespace grouping {
+namespace search::grouping {
struct SessionManagerMetrics : metrics::MetricSet
{
@@ -21,6 +22,4 @@ struct SessionManagerMetrics : metrics::MetricSet
~SessionManagerMetrics();
};
-} // namespace grouping
-} // namespace search
-
+}
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h
index 67f3662549d..5338e450fe5 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.h
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.h
@@ -81,21 +81,14 @@ private:
pid_t _pid;
public:
- ProtonFileHeaderContext(const Proton &proton_,
- const vespalib::string &creator);
- ~ProtonFileHeaderContext();
+ ProtonFileHeaderContext(const Proton &proton_, const vespalib::string &creator);
+ ~ProtonFileHeaderContext() override;
- virtual void
- addTags(vespalib::GenericHeader &header,
- const vespalib::string &name) const override;
-
- void
- setClusterName(const vespalib::string &clusterName,
- const vespalib::string &baseDir);
+ void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override;
+ void setClusterName(const vespalib::string &clusterName, const vespalib::string &baseDir);
};
const config::ConfigUri _configUri;
- vespalib::string _dbFile;
mutable std::shared_timed_mutex _mutex;
MetricsUpdateHook _metricsHook;
MetricsEngine::UP _metricsEngine;
@@ -103,7 +96,7 @@ private:
TLS::UP _tls;
std::unique_ptr<DiskMemUsageSampler> _diskMemUsageSampler;
PersistenceEngine::UP _persistenceEngine;
- DocumentDBMap _documentDBMap;
+ DocumentDBMap _documentDBMap;
MatchEngine::UP _matchEngine;
SummaryEngine::UP _summaryEngine;
DocsumBySlime::UP _docsumBySlime;