This is an automated email from the ASF dual-hosted git repository. rnewson pushed a commit to branch dreyfus_active_searhes in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 0e4c46ce119f8d1ec3d20ba04b3d07a69243e5ad Author: Robert Newson <[email protected]> AuthorDate: Tue Apr 4 20:54:30 2023 +0100 track active search requests --- src/dreyfus/priv/stats_descriptions.cfg | 5 +++++ src/dreyfus/src/dreyfus_httpd.erl | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dreyfus/priv/stats_descriptions.cfg b/src/dreyfus/priv/stats_descriptions.cfg index 7f93ee26a..ad5277f09 100644 --- a/src/dreyfus/priv/stats_descriptions.cfg +++ b/src/dreyfus/priv/stats_descriptions.cfg @@ -63,3 +63,8 @@ {type, counter}, {desc, <<"Search IO directly triggered by client requests">>} ]}. + +[dreyfus, active_searches], [ + {type, counter}, + {desc, <<"number of active search requests">>} +]}. \ No newline at end of file diff --git a/src/dreyfus/src/dreyfus_httpd.erl b/src/dreyfus/src/dreyfus_httpd.erl index f6607d644..32b7cc705 100644 --- a/src/dreyfus/src/dreyfus_httpd.erl +++ b/src/dreyfus/src/dreyfus_httpd.erl @@ -31,7 +31,12 @@ ]). handle_search_req(Req, Db, DDoc) -> - handle_search_req(Req, Db, DDoc, 0, 500). + couch_stats:increment_counter([dreyfus, active_searches]), + try + handle_search_req(Req, Db, DDoc, 0, 500) + after + couch_stats:decrement_counter([dreyfus, active_searches]), + end. handle_search_req( #httpd{method = Method, path_parts = [_, _, _, _, IndexName]} = Req,
