anchor.diff:      end.
   
   % this string munging is damn ugly compared to javascript :(
  -key2str(K) when is_atom(K) -> 
  +key2str(K) when is_atom(K) ->
       atom_to_list(K);
  -key2str(K) when is_binary(K) -> 
  +key2str(K) when is_binary(K) ->
       key2str(binary_to_list(K));
   key2str(K) when is_list(K) ->
       {ok, R1} = re:compile("\\s+"),
  
positive.code: 
  -export([start_link/0]).
  
  %-export([key2str/1,flush/0]). %% export for debugging 
  
  -export([
           code_change/3,
  
negative.code:                         KeyS = key2str(Key),
                          Val = Val0 / (State#state.flush_interval/1000),
                          %% Build stats string for graphite
                          Fragment = [ "stats.", KeyS, " ",
                                       io_lib:format("~w", [Val]), " ",
                                       TsStr, "\n",
  
                                       "stats_counts.", KeyS, " ",
                                       io_lib:format("~w",[NumVals]), " ",
                                       TsStr, "\n"
                                     ],
                          [ Fragment | Acc ]
                  end, [], All),
      {Msg, length(All)}.
  
  