This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch handle-running-tracer in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 7e7eb145c6b6561de21b4d3c3285b1199009c55b Author: Nick Vatamaniuc <[email protected]> AuthorDate: Thu Mar 8 17:02:34 2018 -0500 Handle repeated requests and allow stopping tracer --- src/chttpd/src/chttpd.erl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl index 258449a..bd0ce89 100644 --- a/src/chttpd/src/chttpd.erl +++ b/src/chttpd/src/chttpd.erl @@ -149,13 +149,32 @@ handle_request(MochiReq0) -> maybe_trace(MochiReq) -> case MochiReq:get_header_value("x-couchdb-trace") of "true" -> + maybe_stop_tracer(), couch_log:info("Trace initializing...", []), lg:trace(['_', {scope, [self()]}], lg_file_tracer, "traces.lz4", #{mode => profile}); + "false" -> + maybe_stop_tracer(); _ -> ok end. +maybe_stop_tracer() -> + case whereis(looking_glass_sup) of + undefined -> + false; + Pid when is_pid(Pid) -> + Children = supervisor:which_children(Pid), + case lists:keymember(default, 1, Children) of + true -> + couch_log:info("Trace stopping...", []), + lg:stop(); + false -> + ok + end + end. + + handle_request_int(MochiReq) -> Begin = os:timestamp(), case config:get("chttpd", "socket_options") of -- To stop receiving notification emails like this one, please contact [email protected].
