track active search requests
diff --git a/src/dreyfus/priv/stats_descriptions.cfg b/src/dreyfus/priv/stats_descriptions.cfg index 7f93ee2..8183a4f 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 f6607d6..3bf2522 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,