You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2022/07/20 03:43:55 UTC

[couchdb] branch main updated: Fix stats endpoint

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

vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/main by this push:
     new b3586f1f5 Fix stats endpoint
b3586f1f5 is described below

commit b3586f1f535c495d0dd977f6fb1c826d301e3138
Author: ncshaw <nc...@ibm.com>
AuthorDate: Mon Jan 10 15:21:05 2022 -0600

    Fix stats endpoint
---
 src/chttpd/src/chttpd_node.erl | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/chttpd/src/chttpd_node.erl b/src/chttpd/src/chttpd_node.erl
index cc3370a73..6196b5a7d 100644
--- a/src/chttpd/src/chttpd_node.erl
+++ b/src/chttpd/src/chttpd_node.erl
@@ -358,8 +358,25 @@ format_pid_stats(Mailboxes) ->
 get_distribution_stats() ->
     lists:map(
         fun({Node, Socket}) ->
-            {ok, Stats} = inet:getstat(Socket),
-            {Node, {Stats}}
+            try inet:getstat(Socket) of
+                {ok, Stats} ->
+                    {Node, {Stats}}
+            catch
+                _:_ ->
+                    {Node,
+                        {[
+                            {recv_oct, 0},
+                            {recv_cnt, 0},
+                            {recv_max, 0},
+                            {recv_avg, 0},
+                            {recv_dvi, 0},
+                            {send_oct, 0},
+                            {send_cnt, 0},
+                            {send_max, 0},
+                            {send_avg, 0},
+                            {send_pend, 0}
+                        ]}}
+            end
         end,
         erlang:system_info(dist_ctrl)
     ).