mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
enhance: add metrics for random sample (#40634)
issue: #39541 Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
This commit is contained in:
parent
bab30a41bf
commit
f36d1562bd
@ -101,6 +101,10 @@ PhyRandomSampleNode::GetOutput() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::chrono::high_resolution_clock::time_point start =
|
||||
std::chrono::high_resolution_clock::now();
|
||||
|
||||
RowVectorPtr result = nullptr;
|
||||
if (!is_source_node_) {
|
||||
auto input_col = GetColumnVector(input_);
|
||||
TargetBitmapView input_data(input_col->GetRawData(), input_col->size());
|
||||
@ -126,8 +130,7 @@ PhyRandomSampleNode::GetOutput() {
|
||||
}
|
||||
}
|
||||
|
||||
is_finished_ = true;
|
||||
return std::make_shared<RowVector>(std::vector<VectorPtr>{input_col});
|
||||
result = std::make_shared<RowVector>(std::vector<VectorPtr>{input_col});
|
||||
} else {
|
||||
auto sample_output = std::make_shared<ColumnVector>(
|
||||
TargetBitmap(active_count_), TargetBitmap(active_count_));
|
||||
@ -152,10 +155,18 @@ PhyRandomSampleNode::GetOutput() {
|
||||
data.flip();
|
||||
}
|
||||
|
||||
is_finished_ = true;
|
||||
return std::make_shared<RowVector>(
|
||||
std::vector<VectorPtr>{sample_output});
|
||||
result =
|
||||
std::make_shared<RowVector>(std::vector<VectorPtr>{sample_output});
|
||||
}
|
||||
|
||||
std::chrono::high_resolution_clock::time_point end =
|
||||
std::chrono::high_resolution_clock::now();
|
||||
double duration =
|
||||
std::chrono::duration<double, std::micro>(end - start).count();
|
||||
monitor::internal_core_search_latency_random_sample.Observe(duration /
|
||||
1000);
|
||||
is_finished_ = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@ -208,6 +208,8 @@ std::map<std::string, std::string> retrieveGetTargetEntryLatencyLabels{
|
||||
{"type", "retrieve_get_target_entry_latency"}};
|
||||
std::map<std::string, std::string> searchGetTargetEntryLatencyLabels{
|
||||
{"type", "search_get_target_entry_latency"}};
|
||||
std::map<std::string, std::string> randomSampleLatencyLabels{
|
||||
{"type", "random_sample_latency"}};
|
||||
|
||||
DEFINE_PROMETHEUS_HISTOGRAM_FAMILY(internal_core_search_latency,
|
||||
"[cpp]latency(us) of search on segment")
|
||||
@ -237,6 +239,10 @@ DEFINE_PROMETHEUS_HISTOGRAM(internal_core_retrieve_get_target_entry_latency,
|
||||
DEFINE_PROMETHEUS_HISTOGRAM(internal_core_search_get_target_entry_latency,
|
||||
internal_core_search_latency,
|
||||
searchGetTargetEntryLatencyLabels)
|
||||
DEFINE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_random_sample,
|
||||
internal_core_search_latency,
|
||||
randomSampleLatencyLabels)
|
||||
|
||||
// mmap metrics
|
||||
std::map<std::string, std::string> mmapAllocatedSpaceAnonLabel = {
|
||||
{"type", "anon"}};
|
||||
|
||||
@ -141,6 +141,7 @@ 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);
|
||||
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_search_get_target_entry_latency);
|
||||
DECLARE_PROMETHEUS_HISTOGRAM(internal_core_search_latency_random_sample);
|
||||
|
||||
// async cgo metrics
|
||||
DECLARE_PROMETHEUS_HISTOGRAM_FAMILY(internal_cgo_queue_duration_seconds);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user