MongoDocumentStore implements DocumentStore { @NotNull @Override public Map<String, String> getStats() { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); List<MongoCollection<?>> all = ImmutableList.of(nodes, clusterNodes, settings, journal); all.forEach(c -> toMapBuilder(builder, db.runCommand( new BasicDBObject("collStats", c.getNamespace().getCollectionName()), BasicDBObject.class), c.getNamespace().getCollectionName())); return builder.build(); } MongoDocumentStore(MongoClient client, MongoDatabase db,
                              MongoDocumentNodeStoreBuilderBase<?> builder); boolean isReadOnly(); @Override void finalize(); @Override CacheInvalidationStats invalidateCache(); @Override CacheInvalidationStats invalidateCache(Iterable<String> keys); @Override void invalidateCache(Collection<T> collection, String key); @Override T find(Collection<T> collection, String key); @Override T find(final Collection<T> collection,
                                       final String key,
                                       int maxCacheAge); @NotNull @Override List<T> query(Collection<T> collection,
                                String fromKey,
                                String toKey,
                                int limit); @NotNull @Override List<T> query(Collection<T> collection,
                                              String fromKey,
                                              String toKey,
                                              String indexedProperty,
                                              long startValue,
                                              int limit); @Override void remove(Collection<T> collection, String key); @Override void remove(Collection<T> collection, List<String> keys); @Override int remove(Collection<T> collection, Map<String, Long> toRemove); @Override int remove(Collection<T> collection,
                                    String indexedProperty, long startValue, long endValue); @Nullable @Override T createOrUpdate(Collection<T> collection, UpdateOp update); @SuppressWarnings("unchecked") @Nullable @Override List<T> createOrUpdate(Collection<T> collection,
                                                       List<UpdateOp> updateOps); @Override T findAndUpdate(Collection<T> collection, UpdateOp update); @Override boolean create(Collection<T> collection, List<UpdateOp> updateOps); @Override void dispose(); @Override Iterable<CacheStats> getCacheStats(); @Override Map<String, String> getMetadata(); @NotNull @Override Map<String, String> getStats(); @Override T getIfCached(Collection<T> collection, String key); @Override void setReadWriteMode(String readWriteMode); void setStatsCollector(DocumentStoreStatsCollector stats); @Override long determineServerTimeDifferenceMillis(); static final int IN_CLAUSE_BATCH_SIZE; }
@Test public void getStats() throws Exception { Map<String, String> info = mk.getNodeStore().getDocumentStore().getStats(); assertThat(info.keySet(), hasItem("nodes.count")); assertThat(info.keySet(), hasItem("clusterNodes.count")); assertThat(info.keySet(), hasItem("journal.count")); assertThat(info.keySet(), hasItem("settings.count")); }