anchor.diff:  %% query related stats first.
   %%
   get_stats_search_order(StatName, BucketName) ->
  -    Kind = get_possible_kind(StatName, BucketName),
  -    case Kind of
  -        kind_not_found ->
  -            %% Some stats do not have standard prefix.
  -            %% In that case, we use the default search order.
  -            kinds_list(BucketName);
  -        _ ->
  -            %% Move "Kind" to beginning of the search list.
  -            [Kind | lists:delete(Kind, kinds_list(BucketName))]
  -    end.
  +    GuessedSections = guess_sections_by_pefix(StatName, BucketName),
  +    AllSections = ["@system", BucketName, "@xdcr-" ++ BucketName] ++
  +        services_sections(BucketName),
  +    GuessedSections ++ (AllSections -- GuessedSections).
   
   build_response_for_specific_stat(BucketName, StatName, Params, LocalAddr) ->
       {ClientTStamp, {Step, _, Count} = Window} =
  
positive.code:       end, ListOfLists),
      [hd(ets:lookup(ETS, T)) || #stat_entry{timestamp = T} <- MainSamples].
  
  section_nodes("@system") ->
      ns_cluster_membership:actual_active_nodes();
  section_nodes("@index") ->
      ns_cluster_membership:service_actual_nodes(ns_config:latest(), index);
  section_nodes("@query") ->
      ns_cluster_membership:service_actual_nodes(ns_config:latest(), n1ql);
  section_nodes("@index-"++_) ->
      ns_cluster_membership:service_actual_nodes(ns_config:latest(), index);
  section_nodes("@cbas-"++_) ->
      ns_cluster_membership:service_actual_nodes(ns_config:latest(), cbas);
  section_nodes("@cbas") ->
      ns_cluster_membership:service_actual_nodes(ns_config:latest(), cbas);
  section_nodes("@fts-"++_) ->
      ns_cluster_membership:service_actual_nodes(ns_config:latest(), fts);
  section_nodes("@fts") ->
      ns_cluster_membership:service_actual_nodes(ns_config:latest(), fts);
  section_nodes("@xdcr-"++Bucket) ->
      ns_bucket:live_bucket_nodes(Bucket);
  section_nodes(Bucket) ->
      ns_bucket:live_bucket_nodes(Bucket).
  
  is_persistent("@"++_) ->
      false;
  
negative.code:     SearchList = get_stats_search_order(StatName, BucketName),
      get_samples_from_one_of_kind(SearchList, StatName, ClientTStamp, Window).
  
  %% For many stats, their section can be identified by their prefix.
  guess_sections_by_pefix(StatName, BucketName) ->
      case StatName of
          "query_" ++ _Rest ->
              ["@query"];
          "replication" ++ _Rest ->
              ["@xdcr-" ++ BucketName];
          "views" ++ _Rest ->
              [BucketName];
          "spatial" ++ _Rest ->
              [BucketName];
          "vb_" ++ _Rest ->
              [BucketName];
          "ep_" ++ _Rest ->
              [BucketName];
          Other ->
              case lists:takewhile(fun ($/) -> false; (_) -> true end, Other) of
                  Other ->
                      [];
                  Prefix ->
                      ["@" ++ Prefix,
                       "@" ++ Prefix ++ "-" ++ BucketName]
              end
      end.
  
  %%
  