summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahoo-inc.com>2016-12-15 15:01:38 +0100
committerGeir Storli <geirst@yahoo-inc.com>2016-12-15 15:01:38 +0100
commitd5c4e1020920302f97a03f9eb313b60e9962e90c (patch)
treea0fd4cdd450bc0e8f0b2db87b8793641fdbca1f4 /searchcore
parentfe66f1be411e51a3f767d3db30eebfde458aeb94 (diff)
Expose index memory usage metrics.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp15
4 files changed, 25 insertions, 7 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h
index a4ef714d09d..6521c98bcdb 100644
--- a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h
+++ b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h
@@ -51,7 +51,7 @@ public:
}
virtual search::SearchableStats getSearchableStats() const override {
return search::SearchableStats()
- .memoryUsage(getMemoryUsage().allocatedBytes())
+ .memoryUsage(getMemoryUsage())
.docsInMemory(_index.getNumDocs())
.sizeOnDisk(0);
}
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 68580d90974..213c869a8e4 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
@@ -76,10 +76,17 @@ DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::ResourceUsageMe
{
}
+DocumentDBTaggedMetrics::IndexMetrics::IndexMetrics(MetricSet *parent)
+ : MetricSet("index", "", "Index metrics (memory and disk) for this document db", parent),
+ memoryUsage(this)
+{
+}
+
DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docTypeName)
: MetricSet("documentdb", {{"documenttype", docTypeName}}, "Document DB metrics", nullptr),
job(this),
attribute(this),
+ index(this),
ready("ready", this),
notReady("notready", this),
removed("removed", this)
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 39f4733f66c..323d0766e6f 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
@@ -76,8 +76,16 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet
AttributeMetrics(metrics::MetricSet *parent);
};
+ struct IndexMetrics : metrics::MetricSet
+ {
+ MemoryUsageMetrics memoryUsage;
+
+ IndexMetrics(metrics::MetricSet *parent);
+ };
+
JobMetrics job;
AttributeMetrics attribute;
+ IndexMetrics index;
SubDBMetrics ready;
SubDBMetrics notReady;
SubDBMetrics removed;
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index b21d6c1eba8..46e01757088 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -1245,12 +1245,16 @@ DocumentDB::getIndexManagerFactory(const vespalib::stringref &name) const
namespace {
void
-updateIndexMetrics(LegacyDocumentDBMetrics::IndexMetrics &metrics,
+updateIndexMetrics(DocumentDBMetricsCollection &metrics,
const search::SearchableStats &stats)
{
- metrics.memoryUsage.set(stats.memoryUsage());
- metrics.docsInMemory.set(stats.docsInMemory());
- metrics.diskUsage.set(stats.sizeOnDisk());
+ DocumentDBTaggedMetrics::IndexMetrics &indexMetrics = metrics.getTaggedMetrics().index;
+ indexMetrics.memoryUsage.update(stats.memoryUsage());
+
+ LegacyDocumentDBMetrics::IndexMetrics &legacyIndexMetrics = metrics.getMetrics().index;
+ legacyIndexMetrics.memoryUsage.set(stats.memoryUsage().allocatedBytes());
+ legacyIndexMetrics.docsInMemory.set(stats.docsInMemory());
+ legacyIndexMetrics.diskUsage.set(stats.sizeOnDisk());
}
struct TempAttributeMetric
@@ -1456,6 +1460,7 @@ void
DocumentDB::updateMetrics(DocumentDBMetricsCollection &metrics)
{
updateLegacyMetrics(metrics.getMetrics());
+ updateIndexMetrics(metrics, _subDBs.getReadySubDB()->getSearchableStats());
updateAttributeMetrics(metrics, _subDBs);
updateMetrics(metrics.getTaggedMetrics());
}
@@ -1463,8 +1468,6 @@ DocumentDB::updateMetrics(DocumentDBMetricsCollection &metrics)
void
DocumentDB::updateLegacyMetrics(LegacyDocumentDBMetrics &metrics)
{
- updateIndexMetrics(metrics.index,
- _subDBs.getReadySubDB()->getSearchableStats());
updateMatchingMetrics(metrics.matching, *_subDBs.getReadySubDB());
metrics.executor.update(_writeService.getMasterExecutor().getStats());
metrics.indexExecutor.update(_writeService.getIndexExecutor().getStats());