anchor.diff:              TimeStampBin = exml_query:attr(Entry, <<"timestamp">>),
               TimeStamp = binary_to_integer(TimeStampBin),
               TTD = TS - TimeStamp,
  -            lager:debug("time to delivery ~p", [TTD]),
  +%%            lager:debug("time to delivery ~p", [TTD]),
               amoc_metrics:update_counter(message),
               amoc_metrics:update_time(message_ttd, TTD)
       end.
  
positive.code: process_presence(Client, Stanza) ->
      case exml_query:attr(Stanza, <<"type">>) of
          <<"subscribe">> ->
              lager:debug("presence subscribe stanza ~p", [Stanza]),
              From = exml_query:attr(Stanza, <<"from">>),
              send_presence(Client, <<"subscribed">>, From);
          _ ->
              ok %%it's ok to just ignore other presence notifications
      end.
  
  process_iq(Client, #xmlel{name = <<"iq">>} = Stanza, TS, Requests, Settings) ->
      Id = exml_query:attr(Stanza, <<"id">>),
      Type = exml_query:attr(Stanza, <<"type">>),
      NS = exml_query:path(Stanza, [{element, <<"query">>}, {attr, <<"xmlns">>}]),
      case {Type, NS, Id, maps:get(Id, Requests, undefined)} of
          {<<"get">>, ?NS_DISCO_INFO, _, undefined} ->
              handle_disco_query(Client, Stanza);
          {<<"set">>, ?NS_ROSTER, _, undefined} ->
              ok; %%it's ok to just ignore roster pushes
          {_, undefined, <<"publish", _/binary>>, undefined} ->
              lager:warning("unknown publish iq ~p", [Stanza]);
          {_, undefined, <<"publish", _/binary>>, {Tag, ReqTS}} ->
              handle_publish_resp(Stanza, {Tag, TS - ReqTS}, Settings);
          _ ->
              lager:warning("unexpected iq ~p", [Stanza])
      end,
      maps:remove(Id, Requests).
  
  handle_publish_resp(PublishResult, {Tag, PublishTime}, Settings) ->
      IqTimeout = get_parameter(iq_timeout, Settings),
      case escalus_pred:is_iq_result(PublishResult) of
          true ->
              lager:debug("publish time ~p", [PublishTime]),
              amoc_metrics:update_counter(publication_result, 1),
              amoc_metrics:update_time(publication, PublishTime),
              case Tag of
                  new when IqTimeout * 1000 > PublishTime ->
                      amoc_metrics:update_counter(publication_success, 1);
                  new ->
                      amoc_metrics:update_counter(publication_timeout, 1);
                  timeout -> ok %% do nothing, it's already reported as timeout
              end;
          _ ->
              amoc_metrics:update_counter(publication_error, 1),
              lager:error("Error publishing failed: ~p", [PublishResult]),
              exit(publication_failed)
      end.
  
negative.code:     Content = item_content(PayloadSize),
      Request = publish_pubsub_stanza(Client, Id, Content),
      escalus:send(Client, Request),
      Id.
  
  publish_pubsub_stanza(Client, Id, Content) ->
      ItemId = <<"current">>,
  