summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-01-05 14:56:57 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-01-05 14:56:57 +0000
commit1e0c4b8c3b239c904f7ff5c1303b61123d3d8c06 (patch)
treebc15881aaca6dda9915682ad2797efe05cc68cdc
parentcc59a63bfdf4c58aa0c523f04ef8913c04640389 (diff)
Reduce code visibility and reasons to recompile.
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.h13
4 files changed, 25 insertions, 16 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp
index d087f603fe3..bb8fde53357 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp
@@ -3,6 +3,7 @@
#include "attribute_metrics.h"
#include "documentdb_tagged_metrics.h"
#include "metrics_engine.h"
+#include "content_proton_metrics.h"
#include <vespa/metrics/jsonwriter.h>
#include <vespa/metrics/metricmanager.h>
@@ -12,7 +13,7 @@ LOG_SETUP(".proton.server.metricsengine");
namespace proton {
MetricsEngine::MetricsEngine()
- : _root(),
+ : _root(std::make_unique<ContentProtonMetrics>()),
_manager(std::make_unique<metrics::MetricManager>()),
_metrics_producer(*_manager)
{ }
@@ -24,7 +25,7 @@ MetricsEngine::start(const config::ConfigUri &)
{
{
metrics::MetricLockGuard guard(_manager->getMetricLock());
- _manager->registerMetric(guard, _root);
+ _manager->registerMetric(guard, *_root);
}
// Storage doesnt snapshot unset metrics to save memory. Currently
@@ -54,28 +55,28 @@ void
MetricsEngine::addExternalMetrics(metrics::Metric &child)
{
metrics::MetricLockGuard guard(_manager->getMetricLock());
- _root.registerMetric(child);
+ _root->registerMetric(child);
}
void
MetricsEngine::removeExternalMetrics(metrics::Metric &child)
{
metrics::MetricLockGuard guard(_manager->getMetricLock());
- _root.unregisterMetric(child);
+ _root->unregisterMetric(child);
}
void
MetricsEngine::addDocumentDBMetrics(DocumentDBTaggedMetrics &child)
{
metrics::MetricLockGuard guard(_manager->getMetricLock());
- _root.registerMetric(child);
+ _root->registerMetric(child);
}
void
MetricsEngine::removeDocumentDBMetrics(DocumentDBTaggedMetrics &child)
{
metrics::MetricLockGuard guard(_manager->getMetricLock());
- _root.unregisterMetric(child);
+ _root->unregisterMetric(child);
}
namespace {
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h
index b4cc1bc1c7e..f90f8205817 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h
@@ -2,7 +2,6 @@
#pragma once
-#include "content_proton_metrics.h"
#include "metricswireservice.h"
#include <vespa/metrics/state_api_adapter.h>
@@ -18,11 +17,12 @@ namespace proton {
class AttributeMetrics;
struct DocumentDBTaggedMetrics;
+struct ContentProtonMetrics;
class MetricsEngine : public MetricsWireService
{
private:
- ContentProtonMetrics _root;
+ std::unique_ptr<ContentProtonMetrics> _root;
std::unique_ptr<metrics::MetricManager> _manager;
metrics::StateApiAdapter _metrics_producer;
@@ -30,8 +30,8 @@ public:
typedef std::unique_ptr<MetricsEngine> UP;
MetricsEngine();
- virtual ~MetricsEngine();
- ContentProtonMetrics &root() { return _root; }
+ ~MetricsEngine() override;
+ ContentProtonMetrics &root() { return *_root; }
void start(const config::ConfigUri & configUri);
void addMetricsHook(metrics::UpdateHook &hook);
void removeMetricsHook(metrics::UpdateHook &hook);
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index 0bcbbc14650..f697c4d4672 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -26,6 +26,8 @@
#include <vespa/searchcore/proton/matchengine/matchengine.h>
#include <vespa/searchcore/proton/persistenceengine/persistenceengine.h>
#include <vespa/searchcore/proton/reference/document_db_reference_registry.h>
+#include <vespa/searchcore/proton/metrics/metrics_engine.h>
+#include <vespa/searchcore/proton/metrics/content_proton_metrics.h>
#include <vespa/searchcore/proton/summaryengine/summaryengine.h>
#include <vespa/searchlib/common/packets.h>
#include <vespa/searchlib/transactionlog/trans_log_server_explorer.h>
@@ -966,4 +968,9 @@ Proton::getPersistence()
return *_persistenceEngine;
}
+metrics::MetricManager &
+Proton::getMetricManager() {
+ return _metricsEngine->getManager();
+}
+
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h
index c18737f22b5..573f215c722 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.h
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.h
@@ -15,7 +15,6 @@
#include "shared_threading_service.h"
#include <vespa/eval/eval/llvm/compile_cache.h>
#include <vespa/searchcore/proton/matching/querylimiter.h>
-#include <vespa/searchcore/proton/metrics/metrics_engine.h>
#include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h>
#include <vespa/searchcore/proton/persistenceengine/ipersistenceengineowner.h>
#include <vespa/searchlib/common/fileheadercontext.h>
@@ -29,11 +28,12 @@
#include <mutex>
#include <shared_mutex>
-namespace vespalib {
- class StateServer;
-}
+namespace vespalib { class StateServer; }
namespace search::transactionlog { class TransLogServerApp; }
-namespace metrics { class MetricLockGuard; }
+namespace metrics {
+ class MetricLockGuard;
+ class MetricManager;
+}
namespace storage::spi { struct PersistenceProvider; }
namespace proton {
@@ -46,6 +46,7 @@ class SummaryEngine;
class FlushEngine;
class MatchEngine;
class PersistenceEngine;
+class MetricsEngine;
class Proton : public IProtonConfigurerOwner,
public search::engine::MonitorServer,
@@ -179,7 +180,7 @@ public:
addDocumentDB(const document::DocumentType &docType, BucketSpace bucketSpace, const BootstrapConfig::SP &configSnapshot,
const std::shared_ptr<DocumentDBConfig> &documentDBConfig, InitializeThreads initializeThreads);
- metrics::MetricManager & getMetricManager() { return _metricsEngine->getManager(); }
+ metrics::MetricManager & getMetricManager();
FastOS_ThreadPool & getThreadPool() { return _threadPool; }
bool triggerFlush();