anchor.diff:            t_ref     :: reference()
            }).
   
  +-record(restart, {spec = default_restart() :: restart(),
  +                  history = [] :: [pos_integer()],
  +                  save_n = 10  :: pos_integer()}).
  +
   -record(reporter, {
             pid       :: pid(),
             mref      :: reference(),
  -          module    :: module()
  +          module    :: module(),
  +          opts = [] :: [{atom(), any()}],
  +          restart = #restart{}
            }).
   
   -record(st, {
  
positive.code: -type interval()        :: pos_integer().
  -type callback_result() :: {ok, mod_state()} | any().
  -type extra()           :: any().
  
  %% Callback for function, not cast-based, reports that
  %% are invoked in-process.
  
negative.code:             {noreply, St}
      end;
  
  handle_info({'DOWN', Ref, process, _Pid, Reason}, S) ->
      S1 = case lists:keyfind(Ref, #reporter.mref, S#st.reporters) of
               #reporter {module = Module, restart = Restart} = R ->
                   case add_restart(Restart) of
                       {remove, How} ->
                           case How of
                               {M, F} when is_atom(M), is_atom(F) ->
                                   try M:F(Module, Reason) catch _:_ -> ok end;
                               _ ->
                                   ok
                           end,
                           remove_reporter(R, S);
                       {restart, Restart1} ->
                           restart_reporter(R#reporter{restart = Restart1}, S)
                   end;
               _ -> S
           end,
      {noreply, S1};
  
  handle_info(_Info, State) ->
      ?warning("exometer_report:info(??): ~p~n", [ _Info ]),
      {noreply, State}.
  
  restart_reporter(#reporter{module = Mod, opts = Opts} = R,
                   #st{subscribers = Subs, reporters = Reporters} = S) ->
      {Pid, MRef} = spawn_reporter(Mod, Opts),
      Subs1 = re_subscribe(Mod, Subs),
      R1 = R#reporter{pid = Pid, mref = MRef},
      S#st{subscribers = re_subscribe(Subs1, R1),
           reporters = lists:keyreplace(Mod, #reporter.module, Reporters, R1)}.
  
  re_subscribe([#subscriber{key = #key{reporter = Mod,
                                       metric = Metric,
                                       datapoint = DataPoint,
                                       extra = Extra} = Key,
                            t_ref = OldTRef,
                            interval = Interval} = S | Subs],
               #reporter{module = Mod} = R) ->
      Mod ! {exometer_subscribe, Metric, DataPoint, Interval, Extra},
      erlang:cancel_timer(OldTRef, [flush]),
      TRef = erlang:send_after(Interval, self(), {report, Key, Interval}),
      [S#subscriber{t_ref = TRef} | re_subscribe(Subs, R)];
  re_subscribe([S|Subs], R) ->
      [S|re_subscribe(Subs, R)];
  re_subscribe([], _) ->
      [].
  
  
  %%--------------------------------------------------------------------
  %% @private
  