webmachine – wmtrace exception

webmachine – wmtrace exception – Problem discription

I was getting the following exception when i thought i had wmtrace successfully set up.


The server encountered an error while processing this request:
[{erlang,iolist_to_binary,[error],[]},
{webmachine_decision_core,encode_body,1,
[{file,"src/webmachine_decision_core.erl"},
{line,668}]},
{webmachine_decision_core,decision,1,
[{file,"src/webmachine_decision_core.erl"},
{line,567}]},
{webmachine_decision_core,handle_request,2,
[{file,"src/webmachine_decision_core.erl"},
{line,33}]},
{webmachine_mochiweb,loop,2,[{file,"src/webmachine_mochiweb.erl"},{line,74}]},
{mochiweb_http,parse_headers,5,[{file,"src/mochiweb_http.erl"},{line,180}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]

I had following setup complete and i was seeing the .trace files successfully created after hitting requests to my resource.

init(Config) ->
%% enable tracing the decision core for debugging
{{trace, "traces"}, Config}.

And adding the vmtrace dispatch rule

{["wmtrace",'*'], %% exposed at /wmtrace/*
wmtrace_resource, %% defined in wmtrace_resource.erl
%% (included with webmachine)
[{trace_dir, "traces"}]}. %% trace files are in "traces" directory

Solution

What i had skipped over in the documentation was that the visualization to be enabled.

After hitting ./start.sh hit return and enter the following in the erlang shell (absolute path).

wmtrace_resource:add_dispatch_rule("wmtrace", "/tmp").

…or relative path

wmtrace_resource:add_dispatch_rule("wmtrace", "traces").

This should yield a more inviting message like Traces in /tmp when you hit hostname:port/wmtrace

Resources