basho/riak_kv — pull request #322 by slfritchie (2012-05-14 03:37:42+00:00)
Title: Slf dtrace take1

NOTE: This is a work in progress, to be picked up by someone else while I'm away on vacation.

NOTE: Depends on https://github.com/basho/riak_core/pull/174

All trace messages are funneled first into a function called `dtrace()`
in order to make tracing via Redbug or other Erlang-based tracing tools
a bit easier to use, e.g. `redbug:start({riak_kv_get_fsm, dtrace}).`

However, Erlang tracing syntax (e.g. via Redbug) will be clumsy, but
at least it's doable (I hope). For example, for the get FSM probe category
numbers between 500 & 512:

redbug:start("riak_kv_get_fsm:dtrace('_', X, '_', '_') when 500 =< X, X =< 512", {msgs, 100}).

Eventually, I want to see libusdt used for Erlang-triggerable probes, but
we aren't quite there yet, alas. As a temporary measure, it's likely that
the Erlang virtual machine will have 1024 numbered probes instead of
the current 1. If/when the 1024 numbered probes arrive, the category
code can be used for the 0-to-1023 probe "name" mapping. In the long
term, the code can be used to derive a real ASCII string name for a
probe created by libusdt.