Added logger's queue length to log entry.
authorStanislaw Klekot <dozzie@jarowit.net>
Sun, 29 Oct 2017 17:11:02 +0000 (18:11 +0100)
committerStanislaw Klekot <dozzie@jarowit.net>
Sun, 29 Oct 2017 17:11:02 +0000 (18:11 +0100)
src/statip_state_log.erl

index d1cb3c4..0f671bc 100644 (file)
@@ -120,7 +120,14 @@ call(Request) ->
     gen_server:call(?MODULE, Request)
   catch
     exit:{timeout,_} ->
-      statip_log:warn(state_log, "state logger can't keep up with requests", []),
+      Context = try erlang:process_info(whereis(?MODULE), message_queue_len) of
+        undefined -> [{event, <<"logger died">>}];
+        {message_queue_len, Len} -> [{logger_queue_len, Len}]
+      catch
+        _:_ -> [{event, <<"logger died">>}]
+      end,
+      statip_log:warn(state_log, "state logger can't keep up with requests",
+                      Context),
       {error, timeout}
   end.