Skip to content

Commit

Permalink
Support search topk metric
Browse files Browse the repository at this point in the history
Signed-off-by: chasingegg <[email protected]>
  • Loading branch information
chasingegg committed Aug 16, 2023
1 parent aa4a42f commit bb92652
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/knowhere/prometheus_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ extern const std::unique_ptr<PrometheusClient> prometheusClient;
DECLARE_PROMETHEUS_COUNTER(knowhere_build_count);
DECLARE_PROMETHEUS_COUNTER(knowhere_search_count);
DECLARE_PROMETHEUS_COUNTER(knowhere_range_search_count);
DECLARE_PROMETHEUS_HISTOGRAM(knowhere_search_topk);

} // namespace knowhere
1 change: 1 addition & 0 deletions src/common/index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Index<T>::Search(const DataSet& dataset, const Json& json, const BitsetView& bit

#ifdef NOT_COMPILE_FOR_SWIG
knowhere_search_count.Increment();
knowhere_search_topk.Observe(cfg->k.value());
#endif
return this->node->Search(dataset, *cfg, bitset);
}
Expand Down
1 change: 1 addition & 0 deletions src/common/prometheus_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ const std::unique_ptr<PrometheusClient> prometheusClient = std::make_unique<Prom
DEFINE_PROMETHEUS_COUNTER(knowhere_build_count, "knowhere index build count")
DEFINE_PROMETHEUS_COUNTER(knowhere_search_count, "knowhere search count")
DEFINE_PROMETHEUS_COUNTER(knowhere_range_search_count, "knowhere range search count")
DEFINE_PROMETHEUS_HISTOGRAM(knowhere_search_topk, "knowhere search topk")

} // namespace knowhere

0 comments on commit bb92652

Please sign in to comment.