Skip to content

Commit 64d9f8c

Browse files
author
Brett Hazen
committed
Allow redbug to be enabled from the config file
1 parent 821c56e commit 64d9f8c

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/riak_test_escript.erl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,6 @@ parse_command_line_tests(ParsedArgs) ->
211211
[] -> [undefined];
212212
UpgradeList -> UpgradeList
213213
end,
214-
%% this is a little ugly, the process that creates the ets table to store
215-
%% the tracing state cannot shutdown or the table will be gc'ed, so create
216-
%% a dummy proc that doens't die
217-
rt_redbug:new(),
218214
rt_redbug:set_tracing_applied(proplists:is_defined(apply_traces, ParsedArgs)),
219215
%% Parse Command Line Tests
220216
{CodePaths, SpecificTests} =

src/rt_redbug.erl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,22 @@
2626
-module(rt_redbug).
2727

2828
-export([is_tracing_applied/0]).
29-
-export([new/0]).
3029
-export([set_tracing_applied/1]).
3130
-export([stop/1]).
3231
-export([trace/2, trace/3]).
3332

34-
%% Create a new ets to store globally whether we're tracing or not.
35-
new() ->
36-
ok.
37-
3833
set_tracing_applied(TracingApplied) when is_boolean(TracingApplied) ->
39-
lager:info("Setting apply tracing to ~p", [TracingApplied]),
40-
rt_config:set(apply_traces, TracingApplied).
34+
%% If this flag is set on the command line, but not in the config file
35+
%% then switch it on.
36+
Enabled = case rt_config:get(apply_traces, undefined) of
37+
undefined -> TracingApplied;
38+
ConfigValue -> ConfigValue
39+
end,
40+
lager:info("Setting apply tracing to ~p", [Enabled]),
41+
rt_config:set(apply_traces, Enabled).
4142

4243
is_tracing_applied() ->
43-
rt_config:get(apply_traces).
44+
rt_config:get(apply_traces, false).
4445

4546
%% Apply traces to one or more nodes using redbug tracing and syntax.
4647
%%

0 commit comments

Comments
 (0)