anchor.diff:  value(Registry, Name, LabelValues) ->
     MF = prometheus_metric:check_mf_exists(?TABLE, Registry, Name, LabelValues),
     DU = prometheus_metric:mf_duration_unit(MF),
  -  case  ets:lookup(?TABLE, {Registry, Name, LabelValues}) of
  -    [{_Key, Count, Sum}] -> {Count,
  -                             prometheus_time:maybe_convert_to_du(DU, Sum)};
  -    [] -> undefined
  +
  +  case ets:select(?TABLE, [{{{Registry, Name, LabelValues, '_'}, '$1', '$2'},
  +                            [],
  +                            ['$$']}]) of
  +    [] -> undefined;
  +    Values -> {Count, Sum} = reduce_values(Values),
  +              {Count,  prometheus_time:maybe_convert_to_du(DU, Sum)}
     end.
   
   %%====================================================================
  
positive.code:   Label.
  
  dobserve_impl(Registry, Name, LabelValues, Value) ->
    case ets:lookup(?TABLE, {Registry, Name, LabelValues}) of
      [Metric] ->
        ets:update_element(?TABLE, {Registry, Name, LabelValues},
                           {?SUM_POS, sum(Metric) + Value}),
        ets:update_counter(?TABLE, {Registry, Name, LabelValues},
                           {?COUNTER_POS, 1});
      [] ->
        insert_metric(Registry, Name, LabelValues, Value, fun dobserve_impl/4)
  
negative.code: sum(Metric) ->
    element(?SUM_POS, Metric).
  
  key(Registry, Name, LabelValues) ->
    X = erlang:system_info(scheduler_id),
    Rnd = X band (?WIDTH-1),
    {Registry, Name, LabelValues, Rnd}.
  
  collect_unique_labels(MFValues) ->
    lists:usort([L || [L, _, _] <- MFValues]).
  
  reduce_label_values(Labels, MFValues) ->
    {lists:sum([C || [L, C, _] <- MFValues, L == Labels]),
     lists:sum([S || [L, _, S] <- MFValues, L == Labels])}.
  
  reduce_values(Values) ->
    {lists:sum([C || [C, _] <- Values]),
     lists:sum([S || [_, S] <- Values])}.
  
  create_summary(Name, Help, Data) ->
    prometheus_model_helpers:create_mf(Name, Help, summary, ?MODULE, Data).
  