Fixed order of parameters when calling byteSizeField and timeValueField methods (introduced with #3432 - support for human readable flag)

This commit is contained in:
Luca Cavanna 2013-08-27 10:29:45 +02:00
parent 45699bae5a
commit 6e19ca8080
23 changed files with 80 additions and 81 deletions

View File

@ -126,7 +126,7 @@ public class IndicesSegmentResponse extends BroadcastOperationResponse implement
builder.field(Fields.GENERATION, segment.getGeneration());
builder.field(Fields.NUM_DOCS, segment.getNumDocs());
builder.field(Fields.DELETED_DOCS, segment.getDeletedDocs());
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, segment.getSizeInBytes());
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, segment.getSizeInBytes());
builder.field(Fields.COMMITTED, segment.isCommitted());
builder.field(Fields.SEARCH, segment.isSearch());
if (segment.getVersion() != null) {

View File

@ -126,8 +126,8 @@ public class IndicesStatusResponse extends BroadcastOperationResponse implements
builder.startObject(Fields.INDEX);
if (indexStatus.getStoreSize() != null) {
builder.byteSizeField(Fields.PRIMARY_SIZE, Fields.PRIMARY_SIZE_IN_BYTES, indexStatus.getPrimaryStoreSize());
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, indexStatus.getStoreSize());
builder.byteSizeField(Fields.PRIMARY_SIZE_IN_BYTES, Fields.PRIMARY_SIZE, indexStatus.getPrimaryStoreSize());
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, indexStatus.getStoreSize());
}
builder.endObject();
if (indexStatus.getTranslogOperations() != -1) {
@ -175,7 +175,7 @@ public class IndicesStatusResponse extends BroadcastOperationResponse implements
builder.field(Fields.STATE, shardStatus.getState());
if (shardStatus.getStoreSize() != null) {
builder.startObject(Fields.INDEX);
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, shardStatus.getStoreSize());
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, shardStatus.getStoreSize());
builder.endObject();
}
if (shardStatus.getTranslogId() != -1) {
@ -212,14 +212,14 @@ public class IndicesStatusResponse extends BroadcastOperationResponse implements
builder.startObject(Fields.PEER_RECOVERY);
builder.field(Fields.STAGE, peerRecoveryStatus.getStage());
builder.field(Fields.START_TIME_IN_MILLIS, peerRecoveryStatus.getStartTime());
builder.timeValueField(Fields.TIME, Fields.TIME_IN_MILLIS, peerRecoveryStatus.getTime());
builder.timeValueField(Fields.TIME_IN_MILLIS, Fields.TIME, peerRecoveryStatus.getTime());
builder.startObject(Fields.INDEX);
builder.field(Fields.PROGRESS, peerRecoveryStatus.getIndexRecoveryProgress());
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, peerRecoveryStatus.getIndexSize());
builder.byteSizeField(Fields.REUSED_SIZE, Fields.REUSED_SIZE_IN_BYTES, peerRecoveryStatus.getReusedIndexSize());
builder.byteSizeField(Fields.EXPECTED_RECOVERED_SIZE, Fields.EXPECTED_RECOVERED_SIZE_IN_BYTES, peerRecoveryStatus.getExpectedRecoveredIndexSize());
builder.byteSizeField(Fields.RECOVERED_SIZE, Fields.RECOVERED_SIZE_IN_BYTES, peerRecoveryStatus.getRecoveredIndexSize());
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, peerRecoveryStatus.getIndexSize());
builder.byteSizeField(Fields.REUSED_SIZE_IN_BYTES, Fields.REUSED_SIZE, peerRecoveryStatus.getReusedIndexSize());
builder.byteSizeField(Fields.EXPECTED_RECOVERED_SIZE_IN_BYTES, Fields.EXPECTED_RECOVERED_SIZE, peerRecoveryStatus.getExpectedRecoveredIndexSize());
builder.byteSizeField(Fields.RECOVERED_SIZE_IN_BYTES, Fields.RECOVERED_SIZE, peerRecoveryStatus.getRecoveredIndexSize());
builder.endObject();
builder.startObject(Fields.TRANSLOG);
@ -234,14 +234,14 @@ public class IndicesStatusResponse extends BroadcastOperationResponse implements
builder.startObject(Fields.GATEWAY_RECOVERY);
builder.field(Fields.STAGE, gatewayRecoveryStatus.getStage());
builder.field(Fields.START_TIME_IN_MILLIS, gatewayRecoveryStatus.getStartTime());
builder.timeValueField(Fields.TIME, Fields.TIME_IN_MILLIS, gatewayRecoveryStatus.getTime());
builder.timeValueField(Fields.TIME_IN_MILLIS, Fields.TIME, gatewayRecoveryStatus.getTime());
builder.startObject(Fields.INDEX);
builder.field(Fields.PROGRESS, gatewayRecoveryStatus.getIndexRecoveryProgress());
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, gatewayRecoveryStatus.getIndexSize());
builder.byteSizeField(Fields.REUSED_SIZE, Fields.REUSED_SIZE_IN_BYTES, gatewayRecoveryStatus.getReusedIndexSize());
builder.byteSizeField(Fields.EXPECTED_RECOVERED_SIZE, Fields.EXPECTED_RECOVERED_SIZE_IN_BYTES, gatewayRecoveryStatus.getExpectedRecoveredIndexSize());
builder.byteSizeField(Fields.RECOVERED_SIZE, Fields.RECOVERED_SIZE_IN_BYTES, gatewayRecoveryStatus.getRecoveredIndexSize());
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, gatewayRecoveryStatus.getIndexSize());
builder.byteSizeField(Fields.REUSED_SIZE_IN_BYTES, Fields.REUSED_SIZE, gatewayRecoveryStatus.getReusedIndexSize());
builder.byteSizeField(Fields.EXPECTED_RECOVERED_SIZE_IN_BYTES, Fields.EXPECTED_RECOVERED_SIZE, gatewayRecoveryStatus.getExpectedRecoveredIndexSize());
builder.byteSizeField(Fields.RECOVERED_SIZE_IN_BYTES, Fields.RECOVERED_SIZE, gatewayRecoveryStatus.getRecoveredIndexSize());
builder.endObject();
builder.startObject(Fields.TRANSLOG);
@ -256,10 +256,10 @@ public class IndicesStatusResponse extends BroadcastOperationResponse implements
builder.startObject(Fields.GATEWAY_SNAPSHOT);
builder.field(Fields.STAGE, gatewaySnapshotStatus.getStage());
builder.field(Fields.START_TIME_IN_MILLIS, gatewaySnapshotStatus.getStartTime());
builder.timeValueField(Fields.TIME, Fields.TIME_IN_MILLIS, gatewaySnapshotStatus.getTime());
builder.timeValueField(Fields.TIME_IN_MILLIS, Fields.TIME, gatewaySnapshotStatus.getTime());
builder.startObject(Fields.INDEX);
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, gatewaySnapshotStatus.getIndexSize());
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, gatewaySnapshotStatus.getIndexSize());
builder.endObject();
builder.startObject(Fields.TRANSLOG);

View File

@ -60,8 +60,7 @@ public class HttpInfo implements Streamable, Serializable, ToXContent {
builder.startObject(Fields.HTTP);
builder.field(Fields.BOUND_ADDRESS, address.boundAddress().toString());
builder.field(Fields.PUBLISH_ADDRESS, address.publishAddress().toString());
builder.field(Fields.MAX_CONTENT_LENGTH, new ByteSizeValue(maxContentLength));
builder.field(Fields.MAX_CONTENT_LENGTH_IN_BYTES, maxContentLength);
builder.byteSizeField(Fields.MAX_CONTENT_LENGTH_IN_BYTES, Fields.MAX_CONTENT_LENGTH, maxContentLength);
builder.endObject();
return builder;
}

View File

@ -82,7 +82,7 @@ public class FilterCacheStats implements Streamable, ToXContent {
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject(Fields.FILTER_CACHE);
builder.byteSizeField(Fields.MEMORY_SIZE, Fields.MEMORY_SIZE_IN_BYTES, memorySize);
builder.byteSizeField(Fields.MEMORY_SIZE_IN_BYTES, Fields.MEMORY_SIZE, memorySize);
builder.field(Fields.EVICTIONS, getEvictions());
builder.endObject();
return builder;

View File

@ -73,7 +73,7 @@ public class IdCacheStats implements Streamable, ToXContent {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.ID_CACHE);
builder.byteSizeField(Fields.MEMORY_SIZE, Fields.MEMORY_SIZE_IN_BYTES, memorySize);
builder.byteSizeField(Fields.MEMORY_SIZE_IN_BYTES, Fields.MEMORY_SIZE, memorySize);
builder.endObject();
return builder;
}

View File

@ -119,14 +119,14 @@ public class FieldDataStats implements Streamable, ToXContent {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.FIELDDATA);
builder.byteSizeField(Fields.MEMORY_SIZE, Fields.MEMORY_SIZE_IN_BYTES, memorySize);
builder.byteSizeField(Fields.MEMORY_SIZE_IN_BYTES, Fields.MEMORY_SIZE, memorySize);
builder.field(Fields.EVICTIONS, getEvictions());
if (fields != null) {
builder.startObject(Fields.FIELDS);
for (TObjectLongIterator<String> it = fields.iterator(); it.hasNext(); ) {
it.advance();
builder.startObject(it.key(), XContentBuilder.FieldCaseConversion.NONE);
builder.byteSizeField(Fields.MEMORY_SIZE, Fields.MEMORY_SIZE_IN_BYTES, it.value());
builder.byteSizeField(Fields.MEMORY_SIZE_IN_BYTES, Fields.MEMORY_SIZE, it.value());
builder.endObject();
}
builder.endObject();

View File

@ -88,7 +88,7 @@ public class FlushStats implements Streamable, ToXContent {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.FLUSH);
builder.field(Fields.TOTAL, total);
builder.timeValueField(Fields.TOTAL_TIME, Fields.TOTAL_TIME_IN_MILLIS, totalTimeInMillis);
builder.timeValueField(Fields.TOTAL_TIME_IN_MILLIS, Fields.TOTAL_TIME, totalTimeInMillis);
builder.endObject();
return builder;
}

View File

@ -105,11 +105,11 @@ public class GetStats implements Streamable, ToXContent {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.GET);
builder.field(Fields.TOTAL, getCount());
builder.timeValueField(Fields.TIME, Fields.TIME_IN_MILLIS, getTimeInMillis());
builder.timeValueField(Fields.TIME_IN_MILLIS, Fields.TIME, getTimeInMillis());
builder.field(Fields.EXISTS_TOTAL, existsCount);
builder.timeValueField(Fields.EXISTS_TIME, Fields.EXISTS_TIME_IN_MILLIS, existsTimeInMillis);
builder.timeValueField(Fields.EXISTS_TIME_IN_MILLIS, Fields.EXISTS_TIME, existsTimeInMillis);
builder.field(Fields.MISSING_TOTAL, missingCount);
builder.timeValueField(Fields.MISSING_TIME, Fields.MISSING_TIME_IN_MILLIS, missingTimeInMillis);
builder.timeValueField(Fields.MISSING_TIME_IN_MILLIS, Fields.MISSING_TIME, missingTimeInMillis);
builder.field(Fields.CURRENT, current);
builder.endObject();
return builder;

View File

@ -132,11 +132,11 @@ public class IndexingStats implements Streamable, ToXContent {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field(Fields.INDEX_TOTAL, indexCount);
builder.timeValueField(Fields.INDEX_TIME, Fields.INDEX_TIME_IN_MILLIS, indexTimeInMillis);
builder.timeValueField(Fields.INDEX_TIME_IN_MILLIS, Fields.INDEX_TIME, indexTimeInMillis);
builder.field(Fields.INDEX_CURRENT, indexCurrent);
builder.field(Fields.DELETE_TOTAL, deleteCount);
builder.timeValueField(Fields.DELETE_TIME, Fields.DELETE_TIME_IN_MILLIS, deleteTimeInMillis);
builder.timeValueField(Fields.DELETE_TIME_IN_MILLIS, Fields.DELETE_TIME, deleteTimeInMillis);
builder.field(Fields.DELETE_CURRENT, deleteCurrent);
return builder;

View File

@ -133,11 +133,11 @@ public class MergeStats implements Streamable, ToXContent {
builder.startObject(Fields.MERGES);
builder.field(Fields.CURRENT, current);
builder.field(Fields.CURRENT_DOCS, currentNumDocs);
builder.byteSizeField(Fields.CURRENT_SIZE, Fields.CURRENT_SIZE_IN_BYTES, currentSizeInBytes);
builder.byteSizeField(Fields.CURRENT_SIZE_IN_BYTES, Fields.CURRENT_SIZE, currentSizeInBytes);
builder.field(Fields.TOTAL, total);
builder.timeValueField(Fields.TOTAL_TIME, Fields.TOTAL_TIME_IN_MILLIS, totalTimeInMillis);
builder.timeValueField(Fields.TOTAL_TIME_IN_MILLIS, Fields.TOTAL_TIME, totalTimeInMillis);
builder.field(Fields.TOTAL_DOCS, totalNumDocs);
builder.byteSizeField(Fields.TOTAL_SIZE, Fields.TOTAL_SIZE_IN_BYTES, totalSizeInBytes);
builder.byteSizeField(Fields.TOTAL_SIZE_IN_BYTES, Fields.TOTAL_SIZE, totalSizeInBytes);
builder.endObject();
return builder;
}

View File

@ -47,7 +47,7 @@ public class PercolateStats implements Streamable, ToXContent {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.PERCOLATE);
builder.field(Fields.TOTAL, percolateCount);
builder.timeValueField(Fields.TIME, Fields.TIME_IN_MILLIS, percolateTimeInMillis);
builder.timeValueField(Fields.TIME_IN_MILLIS, Fields.TIME, percolateTimeInMillis);
builder.field(Fields.CURRENT, current);
builder.endObject();
return builder;

View File

@ -88,7 +88,7 @@ public class RefreshStats implements Streamable, ToXContent {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.REFRESH);
builder.field(Fields.TOTAL, total);
builder.timeValueField(Fields.TOTAL_TIME, Fields.TOTAL_TIME_IN_MILLIS, totalTimeInMillis);
builder.timeValueField(Fields.TOTAL_TIME_IN_MILLIS, Fields.TOTAL_TIME, totalTimeInMillis);
builder.endObject();
return builder;
}

View File

@ -133,11 +133,11 @@ public class SearchStats implements Streamable, ToXContent {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field(Fields.QUERY_TOTAL, queryCount);
builder.timeValueField(Fields.QUERY_TIME, Fields.QUERY_TIME_IN_MILLIS, queryTimeInMillis);
builder.timeValueField(Fields.QUERY_TIME_IN_MILLIS, Fields.QUERY_TIME, queryTimeInMillis);
builder.field(Fields.QUERY_CURRENT, queryCurrent);
builder.field(Fields.FETCH_TOTAL, fetchCount);
builder.timeValueField(Fields.FETCH_TIME, Fields.FETCH_TIME_IN_MILLIS, fetchTimeInMillis);
builder.timeValueField(Fields.FETCH_TIME_IN_MILLIS, Fields.FETCH_TIME, fetchTimeInMillis);
builder.field(Fields.FETCH_CURRENT, fetchCurrent);
return builder;

View File

@ -101,8 +101,8 @@ public class StoreStats implements Streamable, ToXContent {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.STORE);
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, sizeInBytes);
builder.timeValueField(Fields.THROTTLE_TIME, Fields.THROTTLE_TIME_IN_MILLIS, throttleTime());
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, sizeInBytes);
builder.timeValueField(Fields.THROTTLE_TIME_IN_MILLIS, Fields.THROTTLE_TIME, throttleTime());
builder.endObject();
return builder;
}

View File

@ -98,7 +98,7 @@ public class WarmerStats implements Streamable, ToXContent {
builder.startObject(Fields.WARMER);
builder.field(Fields.CURRENT, current);
builder.field(Fields.TOTAL, total);
builder.timeValueField(Fields.TOTAL_TIME, Fields.TOTAL_TIME_IN_MILLIS, totalTimeInMillis);
builder.timeValueField(Fields.TOTAL_TIME_IN_MILLIS, Fields.TOTAL_TIME, totalTimeInMillis);
builder.endObject();
return builder;
}

View File

@ -217,13 +217,13 @@ public class FsStats implements Iterable<FsStats.Info>, Streamable, ToXContent {
}
if (info.total != -1) {
builder.byteSizeField(Fields.TOTAL, Fields.TOTAL_IN_BYTES, info.total);
builder.byteSizeField(Fields.TOTAL_IN_BYTES, Fields.TOTAL, info.total);
}
if (info.free != -1) {
builder.byteSizeField(Fields.FREE, Fields.FREE_IN_BYTES, info.free);
builder.byteSizeField(Fields.FREE_IN_BYTES, Fields.FREE, info.free);
}
if (info.available != -1) {
builder.byteSizeField(Fields.AVAILABLE, Fields.AVAILABLE_IN_BYTES, info.available);
builder.byteSizeField(Fields.AVAILABLE_IN_BYTES, Fields.AVAILABLE, info.available);
}
if (info.diskReads != -1) {
@ -234,10 +234,10 @@ public class FsStats implements Iterable<FsStats.Info>, Streamable, ToXContent {
}
if (info.diskReadBytes != -1) {
builder.byteSizeField(Fields.DISK_READ_SIZE, Fields.DISK_READ_SIZE_IN_BYTES, info.getDiskReadSizeInBytes());
builder.byteSizeField(Fields.DISK_READ_SIZE_IN_BYTES, Fields.DISK_READ_SIZE, info.getDiskReadSizeInBytes());
}
if (info.diskWriteBytes != -1) {
builder.byteSizeField(Fields.DISK_WRITE_SIZE, Fields.DISK_WRITE_SIZE_IN_BYTES, info.getDiskWriteSizeInBytes());
builder.byteSizeField(Fields.DISK_WRITE_SIZE_IN_BYTES, Fields.DISK_WRITE_SIZE, info.getDiskWriteSizeInBytes());
}
if (info.diskQueue != -1) {

View File

@ -274,11 +274,11 @@ public class JvmInfo implements Streamable, Serializable, ToXContent {
builder.field(Fields.START_TIME, startTime);
builder.startObject(Fields.MEM);
builder.byteSizeField(Fields.HEAP_INIT, Fields.HEAP_INIT_IN_BYTES, mem.heapInit);
builder.byteSizeField(Fields.HEAP_MAX, Fields.HEAP_MAX_IN_BYTES, mem.heapMax);
builder.byteSizeField(Fields.NON_HEAP_INIT, Fields.NON_HEAP_INIT_IN_BYTES, mem.nonHeapInit);
builder.byteSizeField(Fields.NON_HEAP_MAX, Fields.NON_HEAP_MAX_IN_BYTES, mem.nonHeapMax);
builder.byteSizeField(Fields.DIRECT_MAX, Fields.DIRECT_MAX_IN_BYTES, mem.directMemoryMax);
builder.byteSizeField(Fields.HEAP_INIT_IN_BYTES, Fields.HEAP_INIT, mem.heapInit);
builder.byteSizeField(Fields.HEAP_MAX_IN_BYTES, Fields.HEAP_MAX, mem.heapMax);
builder.byteSizeField(Fields.NON_HEAP_INIT_IN_BYTES, Fields.NON_HEAP_INIT, mem.nonHeapInit);
builder.byteSizeField(Fields.NON_HEAP_MAX_IN_BYTES, Fields.NON_HEAP_MAX, mem.nonHeapMax);
builder.byteSizeField(Fields.DIRECT_MAX_IN_BYTES, Fields.DIRECT_MAX, mem.directMemoryMax);
builder.endObject();
builder.endObject();

View File

@ -283,23 +283,23 @@ public class JvmStats implements Streamable, Serializable, ToXContent {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.JVM);
builder.field(Fields.TIMESTAMP, timestamp);
builder.timeValueField(Fields.UPTIME, Fields.UPTIME_IN_MILLIS, uptime);
builder.timeValueField(Fields.UPTIME_IN_MILLIS, Fields.UPTIME, uptime);
if (mem != null) {
builder.startObject(Fields.MEM);
builder.byteSizeField(Fields.HEAP_USED, Fields.HEAP_USED_IN_BYTES, mem.heapUsed);
builder.byteSizeField(Fields.HEAP_COMMITTED, Fields.HEAP_COMMITTED_IN_BYTES, mem.heapCommitted);
builder.byteSizeField(Fields.NON_HEAP_USED, Fields.NON_HEAP_USED_IN_BYTES, mem.nonHeapUsed);
builder.byteSizeField(Fields.NON_HEAP_COMMITTED, Fields.NON_HEAP_COMMITTED_IN_BYTES, mem.nonHeapCommitted);
builder.byteSizeField(Fields.HEAP_USED_IN_BYTES, Fields.HEAP_USED, mem.heapUsed);
builder.byteSizeField(Fields.HEAP_COMMITTED_IN_BYTES, Fields.HEAP_COMMITTED, mem.heapCommitted);
builder.byteSizeField(Fields.NON_HEAP_USED_IN_BYTES, Fields.NON_HEAP_USED, mem.nonHeapUsed);
builder.byteSizeField(Fields.NON_HEAP_COMMITTED_IN_BYTES, Fields.NON_HEAP_COMMITTED, mem.nonHeapCommitted);
builder.startObject(Fields.POOLS);
for (MemoryPool pool : mem) {
builder.startObject(pool.name(), XContentBuilder.FieldCaseConversion.NONE);
builder.byteSizeField(Fields.USED, Fields.USED_IN_BYTES, pool.used);
builder.byteSizeField(Fields.MAX, Fields.MAX_IN_BYTES, pool.max);
builder.byteSizeField(Fields.USED_IN_BYTES, Fields.USED, pool.used);
builder.byteSizeField(Fields.MAX_IN_BYTES, Fields.MAX, pool.max);
builder.byteSizeField(Fields.PEAK_USED, Fields.PEAK_USED_IN_BYTES, pool.peakUsed);
builder.byteSizeField(Fields.PEAK_MAX, Fields.PEAK_MAX_IN_BYTES, pool.peakMax);
builder.byteSizeField(Fields.PEAK_USED_IN_BYTES, Fields.PEAK_USED, pool.peakUsed);
builder.byteSizeField(Fields.PEAK_MAX_IN_BYTES, Fields.PEAK_MAX, pool.peakMax);
builder.endObject();
}
@ -316,13 +316,13 @@ public class JvmStats implements Streamable, Serializable, ToXContent {
if (gc != null) {
builder.startObject(Fields.GC);
builder.field(Fields.COLLECTION_COUNT, gc.collectionCount());
builder.timeValueField(Fields.COLLECTION_TIME, Fields.COLLECTION_TIME_IN_MILLIS, gc.collectionTime());
builder.timeValueField(Fields.COLLECTION_TIME_IN_MILLIS, Fields.COLLECTION_TIME, gc.collectionTime());
builder.startObject(Fields.COLLECTORS);
for (GarbageCollector collector : gc) {
builder.startObject(collector.name(), XContentBuilder.FieldCaseConversion.NONE);
builder.field(Fields.COLLECTION_COUNT, collector.collectionCount());
builder.timeValueField(Fields.COLLECTION_TIME, Fields.COLLECTION_TIME_IN_MILLIS, collector.collectionTime);
builder.timeValueField(Fields.COLLECTION_TIME_IN_MILLIS, Fields.COLLECTION_TIME, collector.collectionTime);
builder.endObject();
}
builder.endObject();
@ -335,8 +335,8 @@ public class JvmStats implements Streamable, Serializable, ToXContent {
for (BufferPool bufferPool : bufferPools) {
builder.startObject(bufferPool.name(), XContentBuilder.FieldCaseConversion.NONE);
builder.field(Fields.COUNT, bufferPool.count());
builder.byteSizeField(Fields.USED, Fields.USED_IN_BYTES, bufferPool.used);
builder.byteSizeField(Fields.TOTAL_CAPACITY, Fields.TOTAL_CAPACITY_IN_BYTES, bufferPool.totalCapacity);
builder.byteSizeField(Fields.USED_IN_BYTES, Fields.USED, bufferPool.used);
builder.byteSizeField(Fields.TOTAL_CAPACITY_IN_BYTES, Fields.TOTAL_CAPACITY, bufferPool.totalCapacity);
builder.endObject();
}
builder.endObject();

View File

@ -121,17 +121,17 @@ public class OsInfo implements Streamable, Serializable, ToXContent {
builder.field(Fields.TOTAL_CORES, cpu.totalCores());
builder.field(Fields.TOTAL_SOCKETS, cpu.totalSockets());
builder.field(Fields.CORES_PER_SOCKET, cpu.coresPerSocket());
builder.byteSizeField(Fields.CACHE_SIZE, Fields.CACHE_SIZE_IN_BYTES, cpu.cacheSize);
builder.byteSizeField(Fields.CACHE_SIZE_IN_BYTES, Fields.CACHE_SIZE, cpu.cacheSize);
builder.endObject();
}
if (mem != null) {
builder.startObject(Fields.MEM);
builder.byteSizeField(Fields.TOTAL, Fields.TOTAL_IN_BYTES, mem.total);
builder.byteSizeField(Fields.TOTAL_IN_BYTES, Fields.TOTAL, mem.total);
builder.endObject();
}
if (swap != null) {
builder.startObject(Fields.SWAP);
builder.byteSizeField(Fields.TOTAL, Fields.TOTAL_IN_BYTES, swap.total);
builder.byteSizeField(Fields.TOTAL_IN_BYTES, Fields.TOTAL, swap.total);
builder.endObject();
}
builder.endObject();

View File

@ -138,7 +138,7 @@ public class OsStats implements Streamable, Serializable, ToXContent {
builder.field(Fields.TIMESTAMP, timestamp);
if (uptime != -1) {
builder.byteSizeField(Fields.UPTIME, Fields.UPTIME_IN_MILLIS, uptime);
builder.timeValueField(Fields.UPTIME_IN_MILLIS, Fields.UPTIME, uptime);
}
if (loadAverage.length > 0) {
@ -160,22 +160,22 @@ public class OsStats implements Streamable, Serializable, ToXContent {
if (mem != null) {
builder.startObject(Fields.MEM);
builder.byteSizeField(Fields.FREE, Fields.FREE_IN_BYTES, mem.free);
builder.byteSizeField(Fields.USED, Fields.USED_IN_BYTES, mem.used);
builder.byteSizeField(Fields.FREE_IN_BYTES, Fields.FREE, mem.free);
builder.byteSizeField(Fields.USED_IN_BYTES, Fields.USED, mem.used);
builder.field(Fields.FREE_PERCENT, mem.freePercent());
builder.field(Fields.USED_PERCENT, mem.usedPercent());
builder.byteSizeField(Fields.ACTUAL_FREE, Fields.ACTUAL_FREE_IN_BYTES, mem.actualFree);
builder.byteSizeField(Fields.ACTUAL_USED, Fields.ACTUAL_USED_IN_BYTES, mem.actualUsed);
builder.byteSizeField(Fields.ACTUAL_FREE_IN_BYTES, Fields.ACTUAL_FREE, mem.actualFree);
builder.byteSizeField(Fields.ACTUAL_USED_IN_BYTES, Fields.ACTUAL_USED, mem.actualUsed);
builder.endObject();
}
if (swap != null) {
builder.startObject(Fields.SWAP);
builder.byteSizeField(Fields.USED, Fields.USED_IN_BYTES, swap.used);
builder.byteSizeField(Fields.FREE, Fields.FREE_IN_BYTES, swap.free);
builder.byteSizeField(Fields.USED_IN_BYTES, Fields.USED, swap.used);
builder.byteSizeField(Fields.FREE_IN_BYTES, Fields.FREE, swap.free);
builder.endObject();
}

View File

@ -110,16 +110,16 @@ public class ProcessStats implements Streamable, Serializable, ToXContent {
if (cpu != null) {
builder.startObject(Fields.CPU);
builder.field(Fields.PERCENT, cpu.percent());
builder.byteSizeField(Fields.SYS, Fields.SYS_IN_MILLIS, cpu.sys);
builder.byteSizeField(Fields.USER, Fields.USER_IN_MILLIS, cpu.user);
builder.byteSizeField(Fields.TOTAL, Fields.TOTAL_IN_MILLIS, cpu.total);
builder.timeValueField(Fields.SYS_IN_MILLIS, Fields.SYS, cpu.sys);
builder.timeValueField(Fields.USER_IN_MILLIS, Fields.USER, cpu.user);
builder.timeValueField(Fields.TOTAL_IN_MILLIS, Fields.TOTAL, cpu.total);
builder.endObject();
}
if (mem != null) {
builder.startObject(Fields.MEM);
builder.byteSizeField(Fields.RESIDENT, Fields.RESIDENT_IN_BYTES, mem.resident);
builder.byteSizeField(Fields.SHARE, Fields.SHARE_IN_BYTES, mem.share);
builder.byteSizeField(Fields.TOTAL_VIRTUAL, Fields.TOTAL_VIRTUAL_IN_BYTES, mem.totalVirtual);
builder.byteSizeField(Fields.RESIDENT_IN_BYTES, Fields.RESIDENT, mem.resident);
builder.byteSizeField(Fields.SHARE_IN_BYTES, Fields.SHARE, mem.share);
builder.byteSizeField(Fields.TOTAL_VIRTUAL_IN_BYTES, Fields.TOTAL_VIRTUAL, mem.totalVirtual);
builder.endObject();
}
builder.endObject();

View File

@ -92,13 +92,13 @@ public class CompletionStats implements Streamable, ToXContent {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.COMPLETION);
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, sizeInBytes);
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, sizeInBytes);
if (fields != null) {
builder.startObject(Fields.FIELDS);
for (TObjectLongIterator<String> it = fields.iterator(); it.hasNext(); ) {
it.advance();
builder.startObject(it.key(), XContentBuilder.FieldCaseConversion.NONE);
builder.byteSizeField(Fields.SIZE, Fields.SIZE_IN_BYTES, it.value());
builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, it.value());
builder.endObject();
}
builder.endObject();

View File

@ -118,9 +118,9 @@ public class TransportStats implements Streamable, ToXContent {
builder.startObject(Fields.TRANSPORT);
builder.field(Fields.SERVER_OPEN, serverOpen);
builder.field(Fields.RX_COUNT, rxCount);
builder.byteSizeField(Fields.RX_SIZE, Fields.RX_SIZE_IN_BYTES, rxSize);
builder.byteSizeField(Fields.RX_SIZE_IN_BYTES, Fields.RX_SIZE, rxSize);
builder.field(Fields.TX_COUNT, txCount);
builder.byteSizeField(Fields.TX_SIZE, Fields.TX_SIZE_IN_BYTES, txSize);
builder.byteSizeField(Fields.TX_SIZE_IN_BYTES, Fields.TX_SIZE, txSize);
builder.endObject();
return builder;
}