anchor.diff:                         compute_service_gauges),
   
       ServiceStats = [{service_event_name(Service),
  -                     finalize_index_stats(ServiceStats1)}],
  +                     finalize_stats(ServiceStats1)}],
       Prefix = service_prefix(Service),
       AggregatedStats =
           [{Prefix ++ binary_to_list(Bucket), Values} ||
               {Bucket, Values} <-
  -                aggregate_index_stats(
  -                  Service, Stats, KnownBuckets, Defaults)] ++
  +                aggregate_stats(Service, Stats, KnownBuckets, Defaults)] ++
           ServiceStats,
   
       AllCounters = SortedBucketCounters ++ SortedServiceCounters,
       SortedCounters = lists:sort(AllCounters),
       {AggregatedStats, SortedCounters, State}.
   
  -aggregate_index_stats(Service, Stats, Buckets, Defaults) ->
  -    do_aggregate_index_stats(Service, Stats, Buckets, Defaults, []).
  -
  -do_aggregate_index_stats(_Service, [], Buckets, Defaults, Acc) ->
  +aggregate_stats(Service, Stats, Buckets, Defaults) ->
  +    do_aggregate_stats(Service, Stats, Buckets, Defaults, []).
  +
  +do_aggregate_stats(_Service, [], Buckets, Defaults, Acc) ->
       [{B, Defaults} || B <- Buckets] ++ Acc;
  -do_aggregate_index_stats(Service, [{{Bucket, _, _}, _} | _] = Stats,
  -                         Buckets, Defaults, Acc) ->
  +do_aggregate_stats(Service, [{{Bucket, _, _}, _} | _] = Stats,
  +                   Buckets, Defaults, Acc) ->
       {BucketStats, RestStats} =
  -        aggregate_index_bucket_stats(Service, Bucket, Stats, Defaults),
  +        aggregate_bucket_stats(Service, Bucket, Stats, Defaults),
   
       OtherBuckets = lists:delete(Bucket, Buckets),
  -    do_aggregate_index_stats(Service, RestStats, OtherBuckets, Defaults,
  -                             [{Bucket, BucketStats} | Acc]).
  -
  -aggregate_index_bucket_stats(Service, Bucket, Stats, Defaults) ->
  -    do_aggregate_index_bucket_stats(Service, Defaults, Bucket, Stats).
  -
  -do_aggregate_index_bucket_stats(_Service, Acc, _, []) ->
  -    {finalize_index_stats(Acc), []};
  -do_aggregate_index_bucket_stats(Service, Acc, Bucket,
  -                                [{{Bucket, Index, Name}, V} | Rest]) ->
  +    do_aggregate_stats(Service, RestStats, OtherBuckets, Defaults,
  +                       [{Bucket, BucketStats} | Acc]).
  +
  +aggregate_bucket_stats(Service, Bucket, Stats, Defaults) ->
  +    do_aggregate_bucket_stats(Service, Defaults, Bucket, Stats).
  +
  +do_aggregate_bucket_stats(_Service, Acc, _, []) ->
  +    {finalize_stats(Acc), []};
  +do_aggregate_bucket_stats(Service, Acc, Bucket,
  +                          [{{Bucket, Item, Name}, V} | Rest]) ->
       Global = Service:global_index_stat(Name),
  -    PerIndex = Service:per_index_stat(Index, Name),
  +    PerItem = Service:per_index_stat(Item, Name),
   
       Acc1 =
           case lists:keyfind(Global, 1, Acc) of
  
positive.code:                 not_found ->
                      undefined;
                  _ ->
                      {Type, {Bucket, Index, Metric}}
              end;
          _ ->
              undefined
  
negative.code: 
      {ok, #state{service = Service,
                  buckets = Buckets,
                  default_stats = finalize_stats(Defaults)}}.
  
  find_type(_, []) ->
      not_found;
  