Skip to content

Commit

Permalink
Merge pull request #32845 from vespa-engine/toregge/expose-posting-li…
Browse files Browse the repository at this point in the history
…st-cache-metrics

Expose posting list cache metrics.
  • Loading branch information
geirst authored Nov 12, 2024
2 parents c507f13 + 42b5454 commit e1fcaad
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,30 @@ ContentProtonMetrics::SessionCacheMetrics::~SessionCacheMetrics() = default;

ContentProtonMetrics::ProtonExecutorMetrics::~ProtonExecutorMetrics() = default;

ContentProtonMetrics::IndexMetrics::CacheMetrics::CacheMetrics(metrics::MetricSet* parent)
: metrics::MetricSet("cache", {}, "Metrics for caches", parent),
postinglist(this, "postinglist", "Posting list cache metrics", "postinglist_cache")
{
}

ContentProtonMetrics::IndexMetrics::CacheMetrics::~CacheMetrics() = default;

ContentProtonMetrics::IndexMetrics::IndexMetrics(metrics::MetricSet* parent)
: metrics::MetricSet("index", {}, "Metrics for indexes", parent),
cache(this)
{
}

ContentProtonMetrics::IndexMetrics::~IndexMetrics() = default;

ContentProtonMetrics::ContentProtonMetrics()
: metrics::MetricSet("content.proton", {}, "Search engine metrics", nullptr),
configGeneration("config.generation", {}, "The oldest config generation used by this process", this),
transactionLog(this),
resourceUsage(this),
executor(this),
sessionCache(this)
sessionCache(this),
index(this)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#pragma once

#include "cache_metrics.h"
#include "executor_metrics.h"
#include "resource_usage_metrics.h"
#include "trans_log_server_metrics.h"
Expand Down Expand Up @@ -41,11 +42,27 @@ struct ContentProtonMetrics : metrics::MetricSet
~SessionCacheMetrics() override;
};

struct IndexMetrics : public metrics::MetricSet {
struct CacheMetrics : public metrics::MetricSet {

proton::CacheMetrics postinglist;

explicit CacheMetrics(metrics::MetricSet* parent);
~CacheMetrics() override;
};

CacheMetrics cache;

explicit IndexMetrics(metrics::MetricSet* parent);
~IndexMetrics() override;
};

metrics::LongValueMetric configGeneration;
TransLogServerMetrics transactionLog;
ResourceUsageMetrics resourceUsage;
ProtonExecutorMetrics executor;
SessionCacheMetrics sessionCache;
IndexMetrics index;

ContentProtonMetrics();
~ContentProtonMetrics() override;
Expand Down
9 changes: 7 additions & 2 deletions searchcore/src/vespa/searchcore/proton/server/proton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ Proton::Proton(FNET_Transport & transport, const config::ConfigUri & configUri,
_documentDBReferenceRegistry(std::make_shared<DocumentDBReferenceRegistry>()),
_nodeUpLock(),
_nodeUp(),
_posting_list_cache()
_posting_list_cache(),
_last_posting_list_cache_stats()
{ }

BootstrapConfig::SP
Expand Down Expand Up @@ -870,7 +871,11 @@ Proton::updateMetrics(const metrics::MetricLockGuard &)
metrics.field_writer.update(_shared_service->field_writer().getStats());
}
}

if (_posting_list_cache) {
auto stats = _posting_list_cache->get_stats();
_metricsEngine->root().index.cache.postinglist.update_metrics(stats, _last_posting_list_cache_stats);
_last_posting_list_cache_stats = stats;
}
}

void
Expand Down
1 change: 1 addition & 0 deletions searchcore/src/vespa/searchcore/proton/server/proton.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class Proton : public IProtonConfigurerOwner,
std::mutex _nodeUpLock;
std::set<BucketSpace> _nodeUp; // bucketspaces where node is up
std::shared_ptr<search::diskindex::IPostingListCache> _posting_list_cache;
vespalib::CacheStats _last_posting_list_cache_stats;

std::shared_ptr<DocumentDBConfigOwner>
addDocumentDB(const DocTypeName & docTypeName, BucketSpace bucketSpace, const std::string & configid,
Expand Down

0 comments on commit e1fcaad

Please sign in to comment.