-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32866 from vespa-engine/toregge/add-disk-io-metri…
…cs-for-document-type Add disk io metrics for document type.
- Loading branch information
Showing
8 changed files
with
86 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
searchcore/src/vespa/searchcore/proton/metrics/disk_io_metrics.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
|
||
#include "disk_io_metrics.h" | ||
#include <vespa/searchlib/util/cache_disk_io_stats.h> | ||
|
||
using search::CacheDiskIoStats; | ||
using search::DiskIoStats; | ||
|
||
namespace proton { | ||
|
||
namespace { | ||
|
||
void update_helper(metrics::LongValueMetric &metric, const DiskIoStats &stats) { | ||
metric.addTotalValueBatch(stats.read_bytes_total(), stats.read_operations(), | ||
stats.read_bytes_min(), stats.read_bytes_max()); | ||
} | ||
|
||
} | ||
|
||
DiskIoMetrics::SearchMetrics::SearchMetrics(metrics::MetricSet* parent) | ||
: MetricSet("search", {}, "The search io for a given component", parent), | ||
_read_bytes("read_bytes", {}, "Bytes read in posting list files as part of search", this), | ||
_cached_read_bytes("cached_read_bytes", {}, "Bytes read from posting list files cache as part of search", this) | ||
{ | ||
} | ||
|
||
DiskIoMetrics::SearchMetrics::~SearchMetrics() = default; | ||
|
||
void | ||
DiskIoMetrics::SearchMetrics::update(const CacheDiskIoStats& cache_disk_io_stats) | ||
{ | ||
update_helper(_read_bytes, cache_disk_io_stats.read()); | ||
update_helper(_cached_read_bytes, cache_disk_io_stats.cached_read()); | ||
} | ||
|
||
DiskIoMetrics::DiskIoMetrics(metrics::MetricSet* parent) | ||
: MetricSet("io", {}, "The disk usage for a given component", parent), | ||
_search(this) | ||
{ | ||
} | ||
|
||
DiskIoMetrics::~DiskIoMetrics() = default; | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
searchcore/src/vespa/searchcore/proton/metrics/disk_io_metrics.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
|
||
#pragma once | ||
|
||
#include <vespa/metrics/metricset.h> | ||
#include <vespa/metrics/valuemetric.h> | ||
|
||
namespace search { class CacheDiskIoStats; } | ||
|
||
namespace proton { | ||
|
||
/* | ||
* Class containing disk io metrics, e.g. per index field or | ||
* aggregated at document type level. | ||
*/ | ||
class DiskIoMetrics : public metrics::MetricSet { | ||
class SearchMetrics : public metrics::MetricSet { | ||
metrics::LongValueMetric _read_bytes; | ||
metrics::LongValueMetric _cached_read_bytes; | ||
public: | ||
explicit SearchMetrics(metrics::MetricSet* parent); | ||
~SearchMetrics() override; | ||
void update(const search::CacheDiskIoStats& cache_disk_io_stats); | ||
}; | ||
|
||
SearchMetrics _search; | ||
|
||
public: | ||
explicit DiskIoMetrics(metrics::MetricSet* parent); | ||
~DiskIoMetrics() override; | ||
void update(const search::CacheDiskIoStats& cache_disk_io_stats) { _search.update(cache_disk_io_stats); } | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters