-
Notifications
You must be signed in to change notification settings - Fork 617
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 #31100 from vespa-engine/toregge/expose-imported-a…
…ttributes-in-state-explorer Expose imported attributes in state explorer.
- Loading branch information
Showing
5 changed files
with
164 additions
and
22 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
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
28 changes: 28 additions & 0 deletions
28
searchcore/src/vespa/searchcore/proton/attribute/imported_attribute_vector_explorer.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,28 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
|
||
#include "imported_attribute_vector_explorer.h" | ||
#include <vespa/searchlib/attribute/imported_attribute_vector.h> | ||
#include <vespa/searchlib/util/state_explorer_utils.h> | ||
#include <vespa/vespalib/data/slime/cursor.h> | ||
#include <vespa/vespalib/util/memoryusage.h> | ||
|
||
using search::StateExplorerUtils; | ||
using search::attribute::ImportedAttributeVector; | ||
using namespace vespalib::slime; | ||
|
||
namespace proton { | ||
|
||
ImportedAttributeVectorExplorer::ImportedAttributeVectorExplorer(std::shared_ptr<ImportedAttributeVector> attr) | ||
: _attr(std::move(attr)) | ||
{ | ||
} | ||
|
||
void | ||
ImportedAttributeVectorExplorer::get_state(const vespalib::slime::Inserter &inserter, bool) const | ||
{ | ||
Cursor &object = inserter.insertObject(); | ||
auto memory_usage = _attr->get_memory_usage(); | ||
StateExplorerUtils::memory_usage_to_slime(memory_usage, object.setObject("cacheMemoryUsage")); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
searchcore/src/vespa/searchcore/proton/attribute/imported_attribute_vector_explorer.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,26 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
|
||
#pragma once | ||
|
||
#include <vespa/vespalib/net/http/state_explorer.h> | ||
|
||
namespace search::attribute { class ImportedAttributeVector; } | ||
|
||
namespace proton { | ||
|
||
/** | ||
* Class used to explore the state of an imported attribute vector. | ||
*/ | ||
class ImportedAttributeVectorExplorer : public vespalib::StateExplorer | ||
{ | ||
private: | ||
std::shared_ptr<search::attribute::ImportedAttributeVector> _attr; | ||
|
||
public: | ||
ImportedAttributeVectorExplorer(std::shared_ptr<search::attribute::ImportedAttributeVector> attr); | ||
|
||
// Implements vespalib::StateExplorer | ||
void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; | ||
}; | ||
|
||
} |