You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2023/04/04 19:54:57 UTC

[couchdb] branch dreyfus_active_searhes created (now da142e0b3)

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a change to branch dreyfus_active_searhes
in repository https://gitbox.apache.org/repos/asf/couchdb.git


      at da142e0b3 track active search requests

This branch includes the following new commits:

     new da142e0b3 track active search requests

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: track active search requests

Posted by rn...@apache.org.
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 da142e0b35fb78cfb878230a7e0c2bdca180fc7d
Author: Robert Newson <rn...@apache.org>
AuthorDate: Tue Apr 4 20:54:30 2023 +0100

    track active search requests
---
 src/dreyfus/priv/stats_descriptions.cfg | 5 +++++
 src/dreyfus/src/dreyfus_rpc.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_rpc.erl b/src/dreyfus/src/dreyfus_rpc.erl
index 2ebc5ffe5..bfc4ec9f2 100644
--- a/src/dreyfus/src/dreyfus_rpc.erl
+++ b/src/dreyfus/src/dreyfus_rpc.erl
@@ -25,7 +25,12 @@
 
 search(DbName, DDoc, IndexName, QueryArgs) ->
     MFA = {?MODULE, call, [search, DbName, DDoc, IndexName, QueryArgs]},
-    dreyfus_util:time([rpc, search], MFA).
+    couch_stats:increment_counter([dreyfus, active_searches]),
+    try
+        dreyfus_util:time([rpc, search], MFA)
+    after
+        couch_stats:decrement_counter([dreyfus, active_searches]),
+    end.
 
 group1(DbName, DDoc, IndexName, QueryArgs) ->
     MFA = {?MODULE, call, [group1, DbName, DDoc, IndexName, QueryArgs]},