anchor.diff:      {noreply, NewState :: #state{}, timeout() | hibernate} |
       {stop, Reason :: term(), NewState :: #state{}}).
   handle_info(push_metrics, State = #state{}) ->
  -    NewConns = check_connections(State#state.conns),
  +    {NewConns, NewBCs} = check_connections(State#state.conns, State#state.backend_conns),
       erlang:send_after(splay_ms(), self(), push_metrics),
  -    {noreply, State#state{conns = NewConns}};
  +    {noreply, State#state{conns = NewConns, backend_conns = NewBCs}};
   handle_info(_Info, State) ->
       {noreply, State}.
   
  
positive.code:     NextMinute + Splay.
  
  %% implementation
  -spec(check_connections(conn_map()) -> conn_map()).
  check_connections(OldConns) ->
      {ok, Conns} = ip_vs_conn_monitor:get_connections(),
      Splay = minuteman_config:metrics_splay_seconds(),
      Interval = minuteman_config:metrics_interval_seconds(),
      PollDelay = 2*(Splay + Interval), %% assuming these delays are the same in ip_vs_conn
      OnlyNewConns = new_connections(OldConns, Conns),
      Parsed = lists:map(fun ip_vs_conn:parse/1, maps:to_list(OnlyNewConns)),
      lists:foreach(fun (C) -> check_connections(C, PollDelay) end, Parsed),
      ParsedMap = lists:foldl(fun vip_addr_map/2, #{}, Parsed),
      Metrics = tcp_metrics_monitor:get_metrics(),
      P99s = get_p99s(ParsedMap, Metrics),
      lists:foreach(fun apply_p99/1, P99s),
      Conns.
  
  vip_addr_map(C = #ip_vs_conn{dst_ip = IP}, Z) ->
      vip_addr_map(C, Z, maps:get(int_to_ip(IP), Z, undefined)).
  
negative.code:     maps:put(int_to_ip(IP), [C | Ls], Z).
  
  new_connections(OldConns, AllConns) ->
      maps:filter(fun(K, V) -> has_new_state(OldConns, {K, V}) end, AllConns).
  
  has_new_state(_OldConns, {_K, #ip_vs_conn_status{tcp_state = syn_recv}}) -> true;
  has_new_state(_OldConns, {_K, #ip_vs_conn_status{tcp_state = syn_sent}}) -> true;
  has_new_state(OldConns, {K, _V}) -> not(maps:is_key(K, OldConns)).
  
  -spec(apply_connection(#ip_vs_conn{}, integer()) -> ok).
  apply_connection(Conn = #ip_vs_conn{expires = Expires, tcp_state = syn_recv},
                    PollDelay) when Expires < PollDelay ->
      conn_failed(Conn);
  apply_connection(Conn = #ip_vs_conn{expires = Expires, tcp_state = syn_sent},
                    PollDelay) when Expires < PollDelay ->
      conn_failed(Conn);
  apply_connection(#ip_vs_conn{tcp_state = syn_recv}, _PollDelay) -> ok;
  apply_connection(#ip_vs_conn{tcp_state = syn_sent}, _PollDelay) -> ok;
  apply_connection(Conn, _PollDelay) ->
      conn_success(Conn).
  
  -spec(conn_failed(#ip_vs_conn{}) -> ok).
  