anchor.diff:        traverse(RcvSnd, Iter2)
     end.
   
  --spec send_vivaldi_errors(pid_groups:groupname(), non_neg_integer()) -> ok | string().
  -send_vivaldi_errors(Group, Idx) ->
  -    case pid_groups:pid_of(Group, vivaldi) of
  -        failed ->
  -            ok;
  -        Vivaldi ->
  -            comm:send_local(Vivaldi, {get_coordinate, comm:this()}),
  -            receive
  -                ?SCALARIS_RECV(
  -                    {vivaldi_get_coordinate_response, _, Error}, %% ->
  -                    gmetric(both, lists:flatten(io_lib:format("vivaldi_error_~p", [Idx])), "float", Error, "error")
  -                  )
  -            end
  +-spec agg_check_pending(state()) -> state().
  +agg_check_pending(State) ->
  +    Pending = get_agg_pending(State),
  +    if
  +        Pending == 0 ->
  +            Load = get_agg_load(State),
  +            _ = gmetric(both, "kv pairs", "int32", Load, "pairs"),
  +            State;
  +        true ->
  +            State
       end.
   
  -% @doc get number of key-value pairs stored in given node
  --spec get_load(Pid::comm:erl_local_pid()) -> integer().
  -get_load(Pid) ->
  -    comm:send_local(Pid, {get_node_details, comm:this(), [load]}),
  -    receive
  -        ?SCALARIS_RECV(
  -            {get_node_details_response, Details}, %% ->
  -            node_details:get(Details, load)
  -          )
  -    after 2000 ->
  -            0
  -    end.
  +-spec get_last_active(state()) -> non_neg_integer().
  +get_last_active(State) ->
  +    element(1, State).
   
   -spec set_last_active(state()) -> state().
   set_last_active(State) ->
       setelement(1, State, erlang:now()).
  +
  +-spec get_trigger(state()) -> trigger:state().
  +get_trigger(State) ->
  +    element(2, State).
  +
  +-spec set_trigger(trigger:state(), state()) -> state().
  +set_trigger(Trigger, State) ->
  +    setelement(2, State, Trigger).
  +
  +-spec get_agg_id(state()) -> non_neg_integer().
  +get_agg_id(State) ->
  +    element(1, element(3, State)).
  +
  +-spec get_agg_load(state()) -> non_neg_integer().
  +get_agg_load(State) ->
  +    {_AggId, _Pending, Load} = element(3, State),
  +    Load.
  +
  +-spec set_agg_load(non_neg_integer(), state()) -> state().
  +set_agg_load(Load, State) ->
  +    {AggId, Pending, OldLoad} = element(3, State),
  +    setelement(3, State, {AggId, Pending - 1, OldLoad + Load}).
  +
  +-spec get_agg_pending(state()) -> non_neg_integer().
  +get_agg_pending(State) ->
  +    {_AggId, Pending, _Load} = element(3, State),
  +    Pending.
  +
  +-spec set_agg_pending(non_neg_integer(), state()) -> state().
  +set_agg_pending(NumPending, State) ->
  +    {AggId, _Pending, Load} = element(3, State),
  +    setelement(3, State, {AggId, NumPending, Load}).
  +
  +-spec inc_agg_id(state()) -> state().
  +inc_agg_id(State) ->
  +    {AggId, _Pending, _Load} = element(3,State),
  +    setelement(3, State, {AggId + 1, 0, 0}).
  +
  +%reset_load_aggregation(State) ->
  +%    {get_last_active(), 0}.
  
positive.code: 
  -export([start_link/1, init/1, on/2]).
  
  -define(TRACE(X,Y), ok).
  %-define(TRACE(X,Y), io:format(X, Y)).
  
  -type state() :: {LastUpdated :: integer(), Trigger :: trigger:state()}.
  -type message() :: {ganglia_trigger} | {ganglia_periodic}.
  
  -spec start_link(pid_groups:groupname()) -> {ok, pid()}.
  start_link(ServiceGroup) ->
  
negative.code: % @copyright 2007-2013 Zuse Institute Berlin
  
  %   Licensed under the Apache License, Version 2.0 (the "License");
  %   you may not use this file except in compliance with the License.
  