private long getAvgShardSizeInBytes() throws IOException { long sum = 0; int count = 0; for (IndexShard indexShard : this) { sum += indexShard.store().stats().sizeInBytes(); count++; } if (count == 0) { return -1L; } else { return sum / count; } }
public StoreStats stats() throws IOException { ensureOpen(); return new StoreStats(directory.estimateSize()); }
private void completeIndexAttributes(ProtobufSystemInfo.Section.Builder protobuf) { IndicesStatsResponse indicesStats = esClient.prepareStats().all().get(); for (Map.Entry<String, IndexStats> indexStats : indicesStats.getIndices().entrySet()) { String prefix = "Index " + indexStats.getKey() + " - "; setAttribute(protobuf, prefix + "Docs", indexStats.getValue().getPrimaries().getDocs().getCount()); setAttribute(protobuf, prefix + "Shards", indexStats.getValue().getShards().length); setAttribute(protobuf, prefix + "Store Size", byteCountToDisplaySize(indexStats.getValue().getPrimaries().getStore().getSizeInBytes())); } } }
this.store = new StoreStats(); this.fieldData = new FieldDataStats(); this.queryCache = new QueryCacheStats(); docs.add(shardCommonStats.docs); store.add(shardCommonStats.store); fieldData.add(shardCommonStats.fieldData); queryCache.add(shardCommonStats.queryCache);
public ByteSizeValue getSize() { return size(); }
table.addCell(nodeStats.getIndices().getStore().getSize()); table.addCell(used < 0 ? null : new ByteSizeValue(used)); table.addCell(avail.getBytes() < 0 ? null : avail);
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.field(Fields.COUNT, indexCount); shards.toXContent(builder, params); docs.toXContent(builder, params); store.toXContent(builder, params); fieldData.toXContent(builder, params); queryCache.toXContent(builder, params); completion.toXContent(builder, params); segments.toXContent(builder, params); return builder; }
private void sendStoreStats(String type, StoreStats storeStats) { sendInt(type, "sizeInBytes", storeStats.sizeInBytes()); sendInt(type, "throttleTimeInNanos", storeStats.throttleTime().getNanos()); }
public static StoreStats readStoreStats(StreamInput in) throws IOException { StoreStats store = new StoreStats(); store.readFrom(in); return store; }
public TimeValue getThrottleTime() { return throttleTime(); }
private void updateStoreDocs(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.storeSize = nodeIndicesStats.getStore().getSizeInBytes(); nodeIndicesStatsBean.storeThrottleTime = nodeIndicesStats.getStore().getThrottleTime().millis(); nodeIndicesStatsBean.docsCount = nodeIndicesStats.getDocs().getCount(); nodeIndicesStatsBean.docsDeleted = nodeIndicesStats.getDocs().getDeleted(); }
store = new StoreStats(); store.add(stats.getStore()); store.add(stats.getStore());
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(Fields.STORE); builder.humanReadableField(Fields.SIZE_IN_BYTES, Fields.SIZE, size()); builder.endObject(); return builder; }
private void logIndexStats(Map<String, IndexStats> indexStatsMap) { for (IndexStats stat : indexStatsMap.values()) { String indexKey = "esindex_" + stat.getIndex(); Stats.setGauge(StatsUtil.getStatsName(indexKey, "primaryDocCount"), stat.getPrimaries().getDocs().getCount()); Stats.setGauge(StatsUtil.getStatsName(indexKey, "totalDocCount"), stat.getTotal().getDocs().getCount()); Stats.setGauge(StatsUtil.getStatsName(indexKey, "shardsCount"), stat.getShards().length); Stats.setGauge(StatsUtil.getStatsName(indexKey, "primaryStoreSizeMB"), stat.getPrimaries().getStore().getSize().getMbFrac()); Stats.setGauge(StatsUtil.getStatsName(indexKey, "totalStoreSizeMB"), stat.getTotal().getStore().getSize().getMbFrac()); } } }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.field(Fields.COUNT, indexCount); shards.toXContent(builder, params); docs.toXContent(builder, params); store.toXContent(builder, params); fieldData.toXContent(builder, params); queryCache.toXContent(builder, params); completion.toXContent(builder, params); segments.toXContent(builder, params); return builder; }
public TimeValue getThrottleTime() { return throttleTime(); }
this.store = new StoreStats(); this.fieldData = new FieldDataStats(); this.queryCache = new QueryCacheStats(); docs.add(shardCommonStats.docs); store.add(shardCommonStats.store); fieldData.add(shardCommonStats.fieldData); queryCache.add(shardCommonStats.queryCache);
static void buildShardLevelInfo(Logger logger, ShardStats[] stats, ImmutableOpenMap.Builder<String, Long> newShardSizes, ImmutableOpenMap.Builder<ShardRouting, String> newShardRoutingToDataPath, ClusterState state) { for (ShardStats s : stats) { newShardRoutingToDataPath.put(s.getShardRouting(), s.getDataPath()); long size = s.getStats().getStore().sizeInBytes(); String sid = ClusterInfo.shardIdentifierFromRouting(s.getShardRouting()); if (logger.isTraceEnabled()) { logger.trace("shard: {} size: {}", sid, size); } newShardSizes.put(sid, size); } }
public ByteSizeValue getSize() { return size(); }
table.addCell(commonStats == null ? null : commonStats.getStore().getSize()); if (shard.assignedToNode()) { String ip = state.getState().nodes().get(shard.currentNodeId()).getHostAddress();