summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-09-19 22:22:08 +0200
committerGitHub <noreply@github.com>2018-09-19 22:22:08 +0200
commit5ed8c4deeb8384ac4583177ab618f89b3e6c9461 (patch)
treebcc4d693ca4504c0202a897e0d0becb0d9eb5c94
parentf8c982d634a04922decf2610b1e8aec10a7e1b61 (diff)
parent169e1764207be186e8ccabac472f1e3dbfe3c8f6 (diff)
Merge pull request #7017 from vespa-engine/geirst/migrate-legacy-proton-metrics-to-new-naming-scheme
Geirst/migrate legacy proton metrics to new naming scheme
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp66
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h11
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h8
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.cpp29
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.h29
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h11
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp14
9 files changed, 146 insertions, 41 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt
index 6972f6caa98..6e01bae1866 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt
@@ -16,6 +16,7 @@ vespa_add_library(searchcore_proton_metrics STATIC
legacy_attribute_metrics.cpp
legacy_documentdb_metrics.cpp
legacy_proton_metrics.cpp
+ legacy_sessionmanager_metrics.cpp
memory_usage_metrics.cpp
metrics_engine.cpp
resource_usage_metrics.cpp
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 661b5e34f34..335ee63668b 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
@@ -23,18 +23,20 @@ DocumentDBTaggedMetrics::JobMetrics::JobMetrics(metrics::MetricSet* parent)
removedDocumentsPrune("removed_documents_prune", "",
"Pruning of removed documents in 'removed' sub database", this),
total("total", "", "The job load average total of all job metrics", this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::JobMetrics::~JobMetrics() { }
+DocumentDBTaggedMetrics::JobMetrics::~JobMetrics() = default;
DocumentDBTaggedMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, MetricSet *parent)
: MetricSet(name, "", "Sub database metrics", parent),
lidSpace(this),
documentStore(this),
attributes(this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::SubDBMetrics::~SubDBMetrics() { }
+DocumentDBTaggedMetrics::SubDBMetrics::~SubDBMetrics() = default;
DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::LidSpaceMetrics(MetricSet *parent)
: MetricSet("lid_space", "", "Local document id (lid) space metrics for this document sub DB", parent),
@@ -47,9 +49,10 @@ DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::LidSpaceMetrics(MetricSe
lidFragmentationFactor("lid_fragmentation_factor", "",
"The fragmentation factor of this lid space, indicating the amount of holes in the currently used part of the lid space "
"((highest_used_lid - used_lids) / highest_used_lid)", this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::~LidSpaceMetrics() { }
+DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::~LidSpaceMetrics() = default;
DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::CacheMetrics::CacheMetrics(MetricSet *parent)
: MetricSet("cache", "", "Document store cache metrics", parent),
@@ -61,7 +64,7 @@ DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::CacheMetrics::Cache
{
}
-DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::CacheMetrics::~CacheMetrics() {}
+DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::CacheMetrics::~CacheMetrics() = default;
DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::DocumentStoreMetrics(MetricSet *parent)
: MetricSet("document_store", "", "Document store metrics for this document sub DB", parent),
@@ -70,16 +73,18 @@ DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::DocumentStoreMetric
maxBucketSpread("max_bucket_spread", "", "Max bucket spread in underlying files (sum(unique buckets in each chunk)/unique buckets in file)", this),
memoryUsage(this),
cache(this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::~DocumentStoreMetrics() { }
+DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::~DocumentStoreMetrics() = default;
DocumentDBTaggedMetrics::AttributeMetrics::AttributeMetrics(MetricSet *parent)
: MetricSet("attribute", "", "Attribute vector metrics for this document db", parent),
resourceUsage(this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::AttributeMetrics::~AttributeMetrics() { }
+DocumentDBTaggedMetrics::AttributeMetrics::~AttributeMetrics() = default;
DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::ResourceUsageMetrics(MetricSet *parent)
: MetricSet("resource_usage", "", "Usage metrics for various attribute vector resources", parent),
@@ -91,16 +96,17 @@ DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::ResourceUsageMe
{
}
-DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::~ResourceUsageMetrics() { }
+DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::~ResourceUsageMetrics() = default;
DocumentDBTaggedMetrics::IndexMetrics::IndexMetrics(MetricSet *parent)
: MetricSet("index", "", "Index metrics (memory and disk) for this document db", parent),
diskUsage("disk_usage", "", "Disk space usage in bytes", this),
- memoryUsage(this)
-{ }
-
-DocumentDBTaggedMetrics::IndexMetrics::~IndexMetrics() { }
+ memoryUsage(this),
+ docsInMemory("docs_in_memory", "", "Number of documents in memory index", this)
+{
+}
+DocumentDBTaggedMetrics::IndexMetrics::~IndexMetrics() = default;
void
DocumentDBTaggedMetrics::MatchingMetrics::update(const MatchingStats &stats)
@@ -125,9 +131,10 @@ DocumentDBTaggedMetrics::MatchingMetrics::MatchingMetrics(MetricSet *parent)
softDoomFactor("soft_doom_factor", "", "Factor used to compute soft-timeout", this),
queryCollateralTime("query_collateral_time", "", "Average time (sec) spent setting up and tearing down queries", this),
queryLatency("query_latency", "", "Average latency (sec) when matching a query", this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::MatchingMetrics::~MatchingMetrics() {}
+DocumentDBTaggedMetrics::MatchingMetrics::~MatchingMetrics() = default;
DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics(const vespalib::string &name,
size_t numDocIdPartitions,
@@ -150,7 +157,7 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics
}
}
-DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::~RankProfileMetrics() {}
+DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::~RankProfileMetrics() = default;
DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::DocIdPartition(const vespalib::string &name, MetricSet *parent) :
MetricSet("docid_partition", {{"docidPartition", name}}, "DocId Partition profile metrics", parent),
@@ -161,7 +168,7 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::Do
waitTime("wait_time", "", "Time (sec) spent waiting for other external threads and resources", this)
{ }
-DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::~DocIdPartition() {}
+DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::~DocIdPartition() = default;
void
DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::update(const MatchingStats::Partition &stats)
@@ -206,6 +213,15 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::update(const Match
}
}
+DocumentDBTaggedMetrics::SessionCacheMetrics::SessionCacheMetrics(metrics::MetricSet *parent)
+ : metrics::MetricSet("session_cache", "", "Metrics for session caches (search / grouping requests)", parent),
+ search("search", this),
+ grouping("grouping", this)
+{
+}
+
+DocumentDBTaggedMetrics::SessionCacheMetrics::~SessionCacheMetrics() = default;
+
DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docTypeName)
: MetricSet("documentdb", {{"documenttype", docTypeName}}, "Document DB metrics", nullptr),
job(this),
@@ -215,9 +231,11 @@ DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docType
notReady("notready", this),
removed("removed", this),
threadingService("threading_service", this),
- matching(this)
-{ }
+ matching(this),
+ sessionCache(this)
+{
+}
-DocumentDBTaggedMetrics::~DocumentDBTaggedMetrics() { }
+DocumentDBTaggedMetrics::~DocumentDBTaggedMetrics() = default;
-} // namespace proton
+}
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 952fb0304f5..516e6f223bc 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
@@ -4,6 +4,7 @@
#include "attribute_metrics.h"
#include "memory_usage_metrics.h"
#include "executor_threading_service_metrics.h"
+#include "sessionmanager_metrics.h"
#include <vespa/metrics/metricset.h>
#include <vespa/metrics/valuemetric.h>
#include <vespa/searchcore/proton/matching/matching_stats.h>
@@ -101,6 +102,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet
{
metrics::LongValueMetric diskUsage;
MemoryUsageMetrics memoryUsage;
+ metrics::LongValueMetric docsInMemory;
IndexMetrics(metrics::MetricSet *parent);
~IndexMetrics();
@@ -158,6 +160,14 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet
~MatchingMetrics();
};
+ struct SessionCacheMetrics : metrics::MetricSet {
+ SessionManagerMetrics search;
+ SessionManagerMetrics grouping;
+
+ SessionCacheMetrics(metrics::MetricSet *parent);
+ ~SessionCacheMetrics();
+ };
+
JobMetrics job;
AttributeMetrics attribute;
IndexMetrics index;
@@ -166,6 +176,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet
SubDBMetrics removed;
ExecutorThreadingServiceMetrics threadingService;
MatchingMetrics matching;
+ SessionCacheMetrics sessionCache;
DocumentDBTaggedMetrics(const vespalib::string &docTypeName);
~DocumentDBTaggedMetrics();
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 7b01842103b..c61d371ae0b 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h
@@ -2,9 +2,9 @@
#pragma once
-#include "legacy_attribute_metrics.h"
#include "executor_metrics.h"
-#include "sessionmanager_metrics.h"
+#include "legacy_attribute_metrics.h"
+#include "legacy_sessionmanager_metrics.h"
#include <vespa/metrics/summetric.h>
#include <vespa/searchcore/proton/matching/matching_stats.h>
@@ -16,6 +16,8 @@ namespace proton {
* All these metrics have the document type name as part of the metric name,
* which is not flexible for setting up default metric graph dashboards.
*
+ * TODO: Remove on Vespa 7
+ *
* @deprecated Use DocumentDBTaggedMetrics for all new metrics.
*/
struct LegacyDocumentDBMetrics : metrics::MetricSet
@@ -115,7 +117,7 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet
ExecutorMetrics executor;
ExecutorMetrics indexExecutor;
ExecutorMetrics summaryExecutor;
- search::grouping::SessionManagerMetrics sessionManager;
+ LegacySessionManagerMetrics sessionManager;
SubDBMetrics ready;
SubDBMetrics notReady;
SubDBMetrics removed;
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.cpp
new file mode 100644
index 00000000000..097398f42ad
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.cpp
@@ -0,0 +1,29 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "legacy_sessionmanager_metrics.h"
+
+namespace proton {
+
+LegacySessionManagerMetrics::LegacySessionManagerMetrics(metrics::MetricSet *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),
+ numCached("numcached", "", "Number of currently cached sessions", this),
+ numTimedout("numtimedout", "", "Number of timed out sessions", this)
+{
+}
+
+LegacySessionManagerMetrics::~LegacySessionManagerMetrics() = default;
+
+void
+LegacySessionManagerMetrics::update(const proton::matching::SessionManager::Stats &stats)
+{
+ numInsert.inc(stats.numInsert);
+ numPick.inc(stats.numPick);
+ numDropped.inc(stats.numDropped);
+ numCached.set(stats.numCached);
+ numTimedout.inc(stats.numTimedout);
+}
+
+}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.h
new file mode 100644
index 00000000000..3e8e3f54c02
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.h
@@ -0,0 +1,29 @@
+// 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/countmetric.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/searchcore/proton/matching/sessionmanager.h>
+
+namespace proton {
+
+/**
+ * Legacy metrics for session manager cache.
+ * TODO: Remove on Vespa 7
+ */
+struct LegacySessionManagerMetrics : metrics::MetricSet
+{
+ metrics::LongCountMetric numInsert;
+ metrics::LongCountMetric numPick;
+ metrics::LongCountMetric numDropped;
+ metrics::LongValueMetric numCached;
+ metrics::LongCountMetric numTimedout;
+
+ void update(const proton::matching::SessionManager::Stats &stats);
+ LegacySessionManagerMetrics(metrics::MetricSet *parent);
+ ~LegacySessionManagerMetrics();
+};
+
+}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
index f609b850876..5fc41acf33c 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
@@ -1,16 +1,17 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "sessionmanager_metrics.h"
+#include <vespa/vespalib/util/stringfmt.h>
-namespace search::grouping {
+namespace proton {
-SessionManagerMetrics::SessionManagerMetrics(metrics::MetricSet *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),
- numCached("numcached", "", "Number of currently cached sessions", this),
- numTimedout("numtimedout", "", "Number of timed out sessions", this)
+SessionManagerMetrics::SessionManagerMetrics(const vespalib::string &name, metrics::MetricSet *parent)
+ : metrics::MetricSet(name, "", vespalib::make_string("Session manager cache metrics for %s", name.c_str()), parent),
+ numInsert("num_insert", "", "Number of inserted sessions", this),
+ numPick("num_pick", "", "Number if picked sessions", this),
+ numDropped("num_dropped", "", "Number of dropped cached sessions", this),
+ numCached("num_cached", "", "Number of currently cached sessions", this),
+ numTimedout("num_timedout", "", "Number of timed out sessions", this)
{
}
@@ -26,5 +27,4 @@ SessionManagerMetrics::update(const proton::matching::SessionManager::Stats &sta
numTimedout.inc(stats.numTimedout);
}
-
}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
index 37e070c9e04..a1a5dadd1f8 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
@@ -2,13 +2,16 @@
#pragma once
-#include <vespa/searchcore/proton/matching/sessionmanager.h>
-#include <vespa/metrics/metricset.h>
#include <vespa/metrics/countmetric.h>
+#include <vespa/metrics/metricset.h>
#include <vespa/metrics/valuemetric.h>
+#include <vespa/searchcore/proton/matching/sessionmanager.h>
-namespace search::grouping {
+namespace proton {
+/**
+ * Metrics for session manager cache (search or grouping requests).
+ */
struct SessionManagerMetrics : metrics::MetricSet
{
metrics::LongCountMetric numInsert;
@@ -18,7 +21,7 @@ struct SessionManagerMetrics : metrics::MetricSet
metrics::LongCountMetric numTimedout;
void update(const proton::matching::SessionManager::Stats &stats);
- SessionManagerMetrics(metrics::MetricSet *parent);
+ SessionManagerMetrics(const vespalib::string &name, metrics::MetricSet *parent);
~SessionManagerMetrics();
};
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index c974f812acc..18d1a760dd6 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -1018,6 +1018,7 @@ updateIndexMetrics(DocumentDBMetricsCollection &metrics, const search::Searchabl
DocumentDBTaggedMetrics::IndexMetrics &indexMetrics = metrics.getTaggedMetrics().index;
indexMetrics.diskUsage.set(stats.sizeOnDisk());
indexMetrics.memoryUsage.update(stats.memoryUsage());
+ indexMetrics.docsInMemory.set(stats.docsInMemory());
LegacyDocumentDBMetrics::IndexMetrics &legacyIndexMetrics = metrics.getLegacyMetrics().index;
legacyIndexMetrics.memoryUsage.set(stats.memoryUsage().allocatedBytes());
@@ -1166,6 +1167,17 @@ updateMatchingMetrics(DocumentDBMetricsCollection &metrics, const IDocumentSubDB
}
void
+updateSessionCacheMetrics(DocumentDBMetricsCollection &metrics, proton::matching::SessionManager &sessionManager)
+{
+ auto searchStats = sessionManager.getSearchStats();
+ metrics.getTaggedMetrics().sessionCache.search.update(searchStats);
+
+ auto groupingStats = sessionManager.getGroupingStats();
+ metrics.getTaggedMetrics().sessionCache.grouping.update(groupingStats);
+ metrics.getLegacyMetrics().sessionManager.update(groupingStats);
+}
+
+void
updateDocumentStoreCacheHitRate(const CacheStats &current, const CacheStats &last,
metrics::LongAverageMetric &cacheHitRate)
{
@@ -1263,6 +1275,7 @@ DocumentDB::updateMetrics(DocumentDBMetricsCollection &metrics)
updateIndexMetrics(metrics, _subDBs.getReadySubDB()->getSearchableStats());
updateAttributeMetrics(metrics, _subDBs);
updateMatchingMetrics(metrics, *_subDBs.getReadySubDB());
+ updateSessionCacheMetrics(metrics, *_sessionManager);
updateMetrics(metrics.getTaggedMetrics(), threadingServiceStats);
}
@@ -1272,7 +1285,6 @@ DocumentDB::updateLegacyMetrics(LegacyDocumentDBMetrics &metrics, const Executor
metrics.executor.update(threadingServiceStats.getMasterExecutorStats());
metrics.summaryExecutor.update(threadingServiceStats.getSummaryExecutorStats());
metrics.indexExecutor.update(threadingServiceStats.getIndexExecutorStats());
- metrics.sessionManager.update(_sessionManager->getGroupingStats());
updateDocstoreMetrics(metrics.docstore, _subDBs, _lastDocStoreCacheStats.total);
metrics.numDocs.set(getNumDocs());