コード例 #1
0
 public RefreshStats refreshStats() {
   RefreshStats refreshStats = new RefreshStats();
   for (IndexShardStatus shard : this) {
     refreshStats.add(shard.refreshStats());
   }
   return refreshStats;
 }
コード例 #2
0
 // note, requires a wrapping object
 @Override
 public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
   if (docs != null) {
     docs.toXContent(builder, params);
   }
   if (store != null) {
     store.toXContent(builder, params);
   }
   if (indexing != null) {
     indexing.toXContent(builder, params);
   }
   if (get != null) {
     get.toXContent(builder, params);
   }
   if (search != null) {
     search.toXContent(builder, params);
   }
   if (merge != null) {
     merge.toXContent(builder, params);
   }
   if (refresh != null) {
     refresh.toXContent(builder, params);
   }
   if (flush != null) {
     flush.toXContent(builder, params);
   }
   if (warmer != null) {
     warmer.toXContent(builder, params);
   }
   return builder;
 }
コード例 #3
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   if (in.readBoolean()) {
     docs = DocsStats.readDocStats(in);
   }
   if (in.readBoolean()) {
     store = StoreStats.readStoreStats(in);
   }
   if (in.readBoolean()) {
     indexing = IndexingStats.readIndexingStats(in);
   }
   if (in.readBoolean()) {
     get = GetStats.readGetStats(in);
   }
   if (in.readBoolean()) {
     search = SearchStats.readSearchStats(in);
   }
   if (in.readBoolean()) {
     merge = MergeStats.readMergeStats(in);
   }
   if (in.readBoolean()) {
     refresh = RefreshStats.readRefreshStats(in);
   }
   if (in.readBoolean()) {
     flush = FlushStats.readFlushStats(in);
   }
   if (in.readBoolean()) {
     warmer = WarmerStats.readWarmerStats(in);
   }
 }
コード例 #4
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   if (docs == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     docs.writeTo(out);
   }
   if (store == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     store.writeTo(out);
   }
   if (indexing == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     indexing.writeTo(out);
   }
   if (get == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     get.writeTo(out);
   }
   if (search == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     search.writeTo(out);
   }
   if (merge == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     merge.writeTo(out);
   }
   if (refresh == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     refresh.writeTo(out);
   }
   if (flush == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     flush.writeTo(out);
   }
   if (warmer == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     warmer.writeTo(out);
   }
 }
コード例 #5
0
  private Table buildTable(
      RestRequest req,
      ClusterStateResponse state,
      NodesInfoResponse nodesInfo,
      NodesStatsResponse nodesStats) {
    boolean fullId = req.paramAsBoolean("full_id", false);

    DiscoveryNodes nodes = state.getState().nodes();
    String masterId = nodes.masterNodeId();
    Table table = getTableWithHeader(req);

    for (DiscoveryNode node : nodes) {
      NodeInfo info = nodesInfo.getNodesMap().get(node.id());
      NodeStats stats = nodesStats.getNodesMap().get(node.id());

      JvmInfo jvmInfo = info == null ? null : info.getJvm();
      JvmStats jvmStats = stats == null ? null : stats.getJvm();
      FsInfo fsInfo = stats == null ? null : stats.getFs();
      OsStats osStats = stats == null ? null : stats.getOs();
      ProcessStats processStats = stats == null ? null : stats.getProcess();
      NodeIndicesStats indicesStats = stats == null ? null : stats.getIndices();

      table.startRow();

      table.addCell(fullId ? node.id() : Strings.substring(node.getId(), 0, 4));
      table.addCell(info == null ? null : info.getProcess().getId());
      table.addCell(node.getHostName());
      table.addCell(node.getHostAddress());
      if (node.address() instanceof InetSocketTransportAddress) {
        table.addCell(((InetSocketTransportAddress) node.address()).address().getPort());
      } else {
        table.addCell("-");
      }

      table.addCell(node.getVersion().number());
      table.addCell(info == null ? null : info.getBuild().shortHash());
      table.addCell(jvmInfo == null ? null : jvmInfo.version());
      table.addCell(fsInfo == null ? null : fsInfo.getTotal().getAvailable());
      table.addCell(jvmStats == null ? null : jvmStats.getMem().getHeapUsed());
      table.addCell(jvmStats == null ? null : jvmStats.getMem().getHeapUsedPercent());
      table.addCell(jvmInfo == null ? null : jvmInfo.getMem().getHeapMax());
      table.addCell(
          osStats == null ? null : osStats.getMem() == null ? null : osStats.getMem().getUsed());
      table.addCell(
          osStats == null
              ? null
              : osStats.getMem() == null ? null : osStats.getMem().getUsedPercent());
      table.addCell(
          osStats == null ? null : osStats.getMem() == null ? null : osStats.getMem().getTotal());
      table.addCell(processStats == null ? null : processStats.getOpenFileDescriptors());
      table.addCell(
          processStats == null
              ? null
              : calculatePercentage(
                  processStats.getOpenFileDescriptors(), processStats.getMaxFileDescriptors()));
      table.addCell(processStats == null ? null : processStats.getMaxFileDescriptors());

      table.addCell(
          osStats == null ? null : String.format(Locale.ROOT, "%.2f", osStats.getLoadAverage()));
      table.addCell(jvmStats == null ? null : jvmStats.getUptime());
      table.addCell(node.clientNode() ? "c" : node.dataNode() ? "d" : "-");
      table.addCell(
          masterId == null
              ? "x"
              : masterId.equals(node.id()) ? "*" : node.masterNode() ? "m" : "-");
      table.addCell(node.name());

      CompletionStats completionStats =
          indicesStats == null ? null : stats.getIndices().getCompletion();
      table.addCell(completionStats == null ? null : completionStats.getSize());

      FieldDataStats fdStats = indicesStats == null ? null : stats.getIndices().getFieldData();
      table.addCell(fdStats == null ? null : fdStats.getMemorySize());
      table.addCell(fdStats == null ? null : fdStats.getEvictions());

      QueryCacheStats fcStats = indicesStats == null ? null : indicesStats.getQueryCache();
      table.addCell(fcStats == null ? null : fcStats.getMemorySize());
      table.addCell(fcStats == null ? null : fcStats.getEvictions());

      RequestCacheStats qcStats = indicesStats == null ? null : indicesStats.getRequestCache();
      table.addCell(qcStats == null ? null : qcStats.getMemorySize());
      table.addCell(qcStats == null ? null : qcStats.getEvictions());
      table.addCell(qcStats == null ? null : qcStats.getHitCount());
      table.addCell(qcStats == null ? null : qcStats.getMissCount());

      FlushStats flushStats = indicesStats == null ? null : indicesStats.getFlush();
      table.addCell(flushStats == null ? null : flushStats.getTotal());
      table.addCell(flushStats == null ? null : flushStats.getTotalTime());

      GetStats getStats = indicesStats == null ? null : indicesStats.getGet();
      table.addCell(getStats == null ? null : getStats.current());
      table.addCell(getStats == null ? null : getStats.getTime());
      table.addCell(getStats == null ? null : getStats.getCount());
      table.addCell(getStats == null ? null : getStats.getExistsTime());
      table.addCell(getStats == null ? null : getStats.getExistsCount());
      table.addCell(getStats == null ? null : getStats.getMissingTime());
      table.addCell(getStats == null ? null : getStats.getMissingCount());

      IndexingStats indexingStats = indicesStats == null ? null : indicesStats.getIndexing();
      table.addCell(indexingStats == null ? null : indexingStats.getTotal().getDeleteCurrent());
      table.addCell(indexingStats == null ? null : indexingStats.getTotal().getDeleteTime());
      table.addCell(indexingStats == null ? null : indexingStats.getTotal().getDeleteCount());
      table.addCell(indexingStats == null ? null : indexingStats.getTotal().getIndexCurrent());
      table.addCell(indexingStats == null ? null : indexingStats.getTotal().getIndexTime());
      table.addCell(indexingStats == null ? null : indexingStats.getTotal().getIndexCount());
      table.addCell(indexingStats == null ? null : indexingStats.getTotal().getIndexFailedCount());

      MergeStats mergeStats = indicesStats == null ? null : indicesStats.getMerge();
      table.addCell(mergeStats == null ? null : mergeStats.getCurrent());
      table.addCell(mergeStats == null ? null : mergeStats.getCurrentNumDocs());
      table.addCell(mergeStats == null ? null : mergeStats.getCurrentSize());
      table.addCell(mergeStats == null ? null : mergeStats.getTotal());
      table.addCell(mergeStats == null ? null : mergeStats.getTotalNumDocs());
      table.addCell(mergeStats == null ? null : mergeStats.getTotalSize());
      table.addCell(mergeStats == null ? null : mergeStats.getTotalTime());

      PercolateStats percolateStats = indicesStats == null ? null : indicesStats.getPercolate();
      table.addCell(percolateStats == null ? null : percolateStats.getCurrent());
      table.addCell(percolateStats == null ? null : percolateStats.getMemorySize());
      table.addCell(percolateStats == null ? null : percolateStats.getNumQueries());
      table.addCell(percolateStats == null ? null : percolateStats.getTime());
      table.addCell(percolateStats == null ? null : percolateStats.getCount());

      RefreshStats refreshStats = indicesStats == null ? null : indicesStats.getRefresh();
      table.addCell(refreshStats == null ? null : refreshStats.getTotal());
      table.addCell(refreshStats == null ? null : refreshStats.getTotalTime());

      ScriptStats scriptStats = stats == null ? null : stats.getScriptStats();
      table.addCell(scriptStats == null ? null : scriptStats.getCompilations());
      table.addCell(scriptStats == null ? null : scriptStats.getCacheEvictions());

      SearchStats searchStats = indicesStats == null ? null : indicesStats.getSearch();
      table.addCell(searchStats == null ? null : searchStats.getTotal().getFetchCurrent());
      table.addCell(searchStats == null ? null : searchStats.getTotal().getFetchTime());
      table.addCell(searchStats == null ? null : searchStats.getTotal().getFetchCount());
      table.addCell(searchStats == null ? null : searchStats.getOpenContexts());
      table.addCell(searchStats == null ? null : searchStats.getTotal().getQueryCurrent());
      table.addCell(searchStats == null ? null : searchStats.getTotal().getQueryTime());
      table.addCell(searchStats == null ? null : searchStats.getTotal().getQueryCount());
      table.addCell(searchStats == null ? null : searchStats.getTotal().getScrollCurrent());
      table.addCell(searchStats == null ? null : searchStats.getTotal().getScrollTime());
      table.addCell(searchStats == null ? null : searchStats.getTotal().getScrollCount());

      SegmentsStats segmentsStats = indicesStats == null ? null : indicesStats.getSegments();
      table.addCell(segmentsStats == null ? null : segmentsStats.getCount());
      table.addCell(segmentsStats == null ? null : segmentsStats.getMemory());
      table.addCell(segmentsStats == null ? null : segmentsStats.getIndexWriterMemory());
      table.addCell(segmentsStats == null ? null : segmentsStats.getIndexWriterMaxMemory());
      table.addCell(segmentsStats == null ? null : segmentsStats.getVersionMapMemory());
      table.addCell(segmentsStats == null ? null : segmentsStats.getBitsetMemory());

      SuggestStats suggestStats = indicesStats == null ? null : indicesStats.getSuggest();
      table.addCell(suggestStats == null ? null : suggestStats.getCurrent());
      table.addCell(suggestStats == null ? null : suggestStats.getTime());
      table.addCell(suggestStats == null ? null : suggestStats.getCount());

      table.endRow();
    }

    return table;
  }
コード例 #6
0
 public void add(CommonStats stats) {
   if (docs == null) {
     if (stats.docs() != null) {
       docs = new DocsStats();
       docs.add(stats.docs());
     }
   } else {
     docs.add(stats.docs());
   }
   if (store == null) {
     if (stats.store() != null) {
       store = new StoreStats();
       store.add(stats.store());
     }
   } else {
     store.add(stats.store());
   }
   if (indexing == null) {
     if (stats.indexing() != null) {
       indexing = new IndexingStats();
       indexing.add(stats.indexing());
     }
   } else {
     indexing.add(stats.indexing());
   }
   if (get == null) {
     if (stats.get() != null) {
       get = new GetStats();
       get.add(stats.get());
     }
   } else {
     get.add(stats.get());
   }
   if (search == null) {
     if (stats.search() != null) {
       search = new SearchStats();
       search.add(stats.search());
     }
   } else {
     search.add(stats.search());
   }
   if (merge == null) {
     if (stats.merge() != null) {
       merge = new MergeStats();
       merge.add(stats.merge());
     }
   } else {
     merge.add(stats.merge());
   }
   if (refresh == null) {
     if (stats.refresh() != null) {
       refresh = new RefreshStats();
       refresh.add(stats.refresh());
     }
   } else {
     refresh.add(stats.refresh());
   }
   if (flush == null) {
     if (stats.flush() != null) {
       flush = new FlushStats();
       flush.add(stats.flush());
     }
   } else {
     flush.add(stats.flush());
   }
   if (warmer == null) {
     if (stats.warmer() != null) {
       warmer = new WarmerStats();
       warmer.add(stats.warmer());
     }
   } else {
     warmer.add(stats.warmer());
   }
 }