enhance: add internal core latency metric for rescore node (#44010)

For fetching latency of boost.

Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
aoiasd 2025-09-05 17:37:54 +08:00 committed by GitHub
parent 65ddc38d2f
commit c71b47b52c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View File

@ -54,6 +54,10 @@ PhyRescoresNode::GetOutput() {
if (input_ == nullptr) {
return nullptr;
}
std::chrono::high_resolution_clock::time_point scalar_start =
std::chrono::high_resolution_clock::now();
ExecContext* exec_context = operator_context_->get_exec_context();
auto query_context_ = exec_context->get_query_context();
auto query_info = exec_context->get_query_config();
@ -142,6 +146,13 @@ PhyRescoresNode::GetOutput() {
bool large_is_better = PositivelyRelated(metric_type);
sort_search_result(search_result, large_is_better);
query_context_->set_search_result(std::move(search_result));
std::chrono::high_resolution_clock::time_point scalar_end =
std::chrono::high_resolution_clock::now();
double scalar_cost =
std::chrono::duration<double, std::micro>(scalar_end - scalar_start)
.count();
monitor::internal_core_search_latency_rescore.Observe(scalar_cost / 1000);
return input_;
};

View File

@ -163,6 +163,8 @@ std::map<std::string, std::string> groupbyLatencyLabels{
{"type", "groupby_latency"}};
std::map<std::string, std::string> iterativeFilterLatencyLabels{
{"type", "iterative_filter_latency"}};
std::map<std::string, std::string> rescoreLatencyLabels{
{"type", "rescore_latency"}};
std::map<std::string, std::string> scalarProportionLabels{
{"type", "scalar_proportion"}};
std::map<std::string, std::string> getVectorLatencyLabels{
@ -192,6 +194,9 @@ DEFINE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_groupby,
DEFINE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_iterative_filter,
internal_core_search_latency,
iterativeFilterLatencyLabels)
DEFINE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_rescore,
internal_core_search_latency,
rescoreLatencyLabels)
DEFINE_PROMETHEUS_HISTOGRAM_WITH_BUCKETS(
internal_core_search_latency_scalar_proportion,
internal_core_search_latency,

View File

@ -72,6 +72,7 @@ DECLARE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_scalar);
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_vector);
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_groupby);
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_iterative_filter);
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_rescore);
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_scalar_proportion);
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_get_vector_latency);
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_retrieve_get_target_entry_latency);