summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2023-04-04 20:54:30 +0100
committerRobert Newson <rnewson@apache.org>2023-04-05 14:14:02 +0100
commit8899157d7ec80816c5d502436289de9a61edd67a (patch)
tree7cc622cafe46aa876df7123e60d93c809c3bea4f
parenta9bce2f598edc8ef843baa9412c60d22157eeabf (diff)
downloadcouchdb-dreyfus_active_searhes.tar.gz
track active search requestsdreyfus_active_searhes
-rw-r--r--src/dreyfus/priv/stats_descriptions.cfg5
-rw-r--r--src/dreyfus/src/dreyfus_httpd.erl7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/dreyfus/priv/stats_descriptions.cfg b/src/dreyfus/priv/stats_descriptions.cfg
index 7f93ee26a..8183a4f9a 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..3bf2522fd 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,