anchor.diff:                                               "(measured from replication_changes_left)">>}]}];
                          false ->
                              []
  -                   end ++ case AddQuery of
  -                              true ->
  -                                  [{struct,[{title,<<"N1QL queries/sec">>},
  -                                            {name, <<"query_requests">>},
  -                                            {desc, <<"Number of N1QL requests processed per second">>}]}];
  -                              _ -> []
  -                          end ++ case AddIndex of
  -                                     false ->
  -                                         [];
  -                                     _ ->
  -                                         [{struct, [{isBytes, true},
  -                                                    {title, <<"index data size">>},
  -                                                    {name, global_index_stat(<<"data_size">>)},
  -                                                    {desc, <<"Actual data size consumed by the index">>}]},
  -                                          {struct, [{title, <<"index disk size">>},
  -                                                    {name, global_index_stat(<<"disk_size">>)},
  -                                                    {desc, <<"Total disk file size consumed by the index">>},
  -                                                    {isBytes, true}]},
  -                                          {struct, [{title, <<"index fragmentation %">>},
  -                                                    {name, global_index_stat(<<"fragmentation">>)},
  -                                                    {desc, <<"Percentage fragmentation of the index. Note: at small index sizes of less than a hundred kB, the static overhead of the index disk file will inflate the index fragmentation percentage">>}]},
  -                                          {struct, [{title, <<"index scanned/sec">>},
  -                                                    {name, global_index_stat(<<"num_rows_returned">>)},
  -                                                    {desc, <<"Number of index items scanned by the indexer per second">>}]}]
  -                                 end)
  -               ]}]},
  +                   end ++
  +                       membase_query_stats_description(AddQuery) ++
  +                       membase_index_stats_description(IndexNodes)
  +                  )]}]},
        {struct,[{blockName,<<"vBucket Resources">>},
                 {extraCSSClasses,<<"dynamic_withtotal dynamic_closed">>},
                 {columns,
  
positive.code:               [MyStats|Stats]
        end, [], DictBySig).
  
  couchbase_index_stats_descriptions(_, false) ->
      [];
  couchbase_index_stats_descriptions(BucketId, AddIndex) ->
      simple_memoize({stats_directory_index, BucketId, AddIndex},
                     fun () ->
                             do_couchbase_index_stats_descriptions(BucketId, AddIndex)
                     end, 5000).
  
  do_couchbase_index_stats_descriptions(BucketId, AddIndex) ->
      Nodes = case AddIndex of
                  all ->
                      section_nodes("@index-" ++ BucketId);
                  XNodes ->
  
negative.code:                     end
              end,
      BS = grab_ui_stats(Bucket, Nodes, HaveStamp, Wnd),
      SS = grab_ui_stats("@system", Nodes, HaveStamp, Wnd),
  
      GoXDCRStats = [{iolist_to_binary([<<"@xdcr-">>, Bucket]),
                      {grab_ui_stats("@xdcr-" ++ Bucket, Nodes, HaveStamp, Wnd)}}],
  
      {HaveQuery, _, QStats} =
          maybe_grab_stats("@query", Nodes, HaveStamp, Wnd, GoXDCRStats),
  
      {_, IndexNodes, IStats} =
          maybe_grab_stats("@index-" ++ Bucket, Nodes, HaveStamp, Wnd, QStats),
  
      Stats = [{list_to_binary(Bucket), {BS}},
               {<<"@system">>, {SS}}
               | IStats],
      NewHaveStamp = [case proplists:get_value(timestamp, S) of
                          [] -> {Name, 0};
                          L -> {Name, lists:last(L)}
                      end || {Name, {S}} <- Stats],
      StatsDirectoryV = erlang:phash2(base_stats_directory(Bucket, HaveQuery, IndexNodes)),
      DirAddQ = case HaveQuery of
                    true ->
                        [{addq, <<"1">>}];
                    false ->
                        []
                end,
      DirAddI = case IndexNodes of
                    [] -> DirAddQ;
                    _ ->
                        NodesJSON = iolist_to_binary(ejson:encode(IndexNodes)),
                        [{addi, NodesJSON} | DirAddQ]
                end,
      DirQS = [{v, integer_to_list(StatsDirectoryV)} | DirAddI],
  