From 6e19ca808056e3c69545a837180d23faa863fec7 Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Tue, 27 Aug 2013 10:29:45 +0200 Subject: [PATCH] Fixed order of parameters when calling byteSizeField and timeValueField methods (introduced with #3432 - support for human readable flag) --- .../segments/IndicesSegmentResponse.java | 2 +- .../indices/status/IndicesStatusResponse.java | 30 +++++++++---------- .../java/org/elasticsearch/http/HttpInfo.java | 3 +- .../index/cache/filter/FilterCacheStats.java | 2 +- .../index/cache/id/IdCacheStats.java | 2 +- .../index/fielddata/FieldDataStats.java | 4 +-- .../elasticsearch/index/flush/FlushStats.java | 2 +- .../org/elasticsearch/index/get/GetStats.java | 6 ++-- .../index/indexing/IndexingStats.java | 4 +-- .../elasticsearch/index/merge/MergeStats.java | 6 ++-- .../percolator/stats/PercolateStats.java | 2 +- .../index/refresh/RefreshStats.java | 2 +- .../index/search/stats/SearchStats.java | 4 +-- .../elasticsearch/index/store/StoreStats.java | 4 +-- .../index/warmer/WarmerStats.java | 2 +- .../org/elasticsearch/monitor/fs/FsStats.java | 10 +++---- .../elasticsearch/monitor/jvm/JvmInfo.java | 10 +++---- .../elasticsearch/monitor/jvm/JvmStats.java | 26 ++++++++-------- .../org/elasticsearch/monitor/os/OsInfo.java | 6 ++-- .../org/elasticsearch/monitor/os/OsStats.java | 14 ++++----- .../monitor/process/ProcessStats.java | 12 ++++---- .../suggest/completion/CompletionStats.java | 4 +-- .../transport/TransportStats.java | 4 +-- 23 files changed, 80 insertions(+), 81 deletions(-) diff --git a/src/main/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentResponse.java b/src/main/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentResponse.java index b7037ed7026..fcac07352f4 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentResponse.java @@ -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) { diff --git a/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusResponse.java b/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusResponse.java index 5795512dca3..f90854ff78e 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusResponse.java @@ -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); diff --git a/src/main/java/org/elasticsearch/http/HttpInfo.java b/src/main/java/org/elasticsearch/http/HttpInfo.java index 4d5e56c0c13..d768e1f8770 100644 --- a/src/main/java/org/elasticsearch/http/HttpInfo.java +++ b/src/main/java/org/elasticsearch/http/HttpInfo.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/index/cache/filter/FilterCacheStats.java b/src/main/java/org/elasticsearch/index/cache/filter/FilterCacheStats.java index a0c71463623..fd04cb85c2a 100644 --- a/src/main/java/org/elasticsearch/index/cache/filter/FilterCacheStats.java +++ b/src/main/java/org/elasticsearch/index/cache/filter/FilterCacheStats.java @@ -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; diff --git a/src/main/java/org/elasticsearch/index/cache/id/IdCacheStats.java b/src/main/java/org/elasticsearch/index/cache/id/IdCacheStats.java index 9c389fe2390..0249775e609 100644 --- a/src/main/java/org/elasticsearch/index/cache/id/IdCacheStats.java +++ b/src/main/java/org/elasticsearch/index/cache/id/IdCacheStats.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java b/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java index df726fcf3d4..9c7fa15eb5a 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java +++ b/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java @@ -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 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(); diff --git a/src/main/java/org/elasticsearch/index/flush/FlushStats.java b/src/main/java/org/elasticsearch/index/flush/FlushStats.java index f4b934ccc41..e90b637fe09 100644 --- a/src/main/java/org/elasticsearch/index/flush/FlushStats.java +++ b/src/main/java/org/elasticsearch/index/flush/FlushStats.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/index/get/GetStats.java b/src/main/java/org/elasticsearch/index/get/GetStats.java index ac6987fd77a..2ea8d8ce15a 100644 --- a/src/main/java/org/elasticsearch/index/get/GetStats.java +++ b/src/main/java/org/elasticsearch/index/get/GetStats.java @@ -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; diff --git a/src/main/java/org/elasticsearch/index/indexing/IndexingStats.java b/src/main/java/org/elasticsearch/index/indexing/IndexingStats.java index 400eaf2f949..447e260615d 100644 --- a/src/main/java/org/elasticsearch/index/indexing/IndexingStats.java +++ b/src/main/java/org/elasticsearch/index/indexing/IndexingStats.java @@ -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; diff --git a/src/main/java/org/elasticsearch/index/merge/MergeStats.java b/src/main/java/org/elasticsearch/index/merge/MergeStats.java index 0482f834117..451757da837 100644 --- a/src/main/java/org/elasticsearch/index/merge/MergeStats.java +++ b/src/main/java/org/elasticsearch/index/merge/MergeStats.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/index/percolator/stats/PercolateStats.java b/src/main/java/org/elasticsearch/index/percolator/stats/PercolateStats.java index c4421230af4..2c220e218b4 100644 --- a/src/main/java/org/elasticsearch/index/percolator/stats/PercolateStats.java +++ b/src/main/java/org/elasticsearch/index/percolator/stats/PercolateStats.java @@ -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; diff --git a/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java b/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java index dce1e12c924..4d5e2878c89 100644 --- a/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java +++ b/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java b/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java index fb58be19906..984c7c3d5e8 100644 --- a/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java +++ b/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java @@ -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; diff --git a/src/main/java/org/elasticsearch/index/store/StoreStats.java b/src/main/java/org/elasticsearch/index/store/StoreStats.java index 0450b71a915..6a38ec15205 100644 --- a/src/main/java/org/elasticsearch/index/store/StoreStats.java +++ b/src/main/java/org/elasticsearch/index/store/StoreStats.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/index/warmer/WarmerStats.java b/src/main/java/org/elasticsearch/index/warmer/WarmerStats.java index 2e8c42a6587..4a7318b73f1 100644 --- a/src/main/java/org/elasticsearch/index/warmer/WarmerStats.java +++ b/src/main/java/org/elasticsearch/index/warmer/WarmerStats.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/monitor/fs/FsStats.java b/src/main/java/org/elasticsearch/monitor/fs/FsStats.java index 8436382646b..c4a332f5abb 100644 --- a/src/main/java/org/elasticsearch/monitor/fs/FsStats.java +++ b/src/main/java/org/elasticsearch/monitor/fs/FsStats.java @@ -217,13 +217,13 @@ public class FsStats implements Iterable, 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, 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) { diff --git a/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java b/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java index 23e22e97425..496968a8882 100644 --- a/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java +++ b/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java @@ -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(); diff --git a/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java b/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java index 6b74267d0e6..d80dd455042 100644 --- a/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java +++ b/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java @@ -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(); diff --git a/src/main/java/org/elasticsearch/monitor/os/OsInfo.java b/src/main/java/org/elasticsearch/monitor/os/OsInfo.java index b10c99e2cc0..a1a9a251ec7 100644 --- a/src/main/java/org/elasticsearch/monitor/os/OsInfo.java +++ b/src/main/java/org/elasticsearch/monitor/os/OsInfo.java @@ -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(); diff --git a/src/main/java/org/elasticsearch/monitor/os/OsStats.java b/src/main/java/org/elasticsearch/monitor/os/OsStats.java index 75ebc719519..60c80c5d523 100644 --- a/src/main/java/org/elasticsearch/monitor/os/OsStats.java +++ b/src/main/java/org/elasticsearch/monitor/os/OsStats.java @@ -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(); } diff --git a/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java b/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java index d3f751cacd4..fb1dcb870d7 100644 --- a/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java +++ b/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java @@ -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(); diff --git a/src/main/java/org/elasticsearch/search/suggest/completion/CompletionStats.java b/src/main/java/org/elasticsearch/search/suggest/completion/CompletionStats.java index 3a450a96d14..70ed78bf182 100644 --- a/src/main/java/org/elasticsearch/search/suggest/completion/CompletionStats.java +++ b/src/main/java/org/elasticsearch/search/suggest/completion/CompletionStats.java @@ -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 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(); diff --git a/src/main/java/org/elasticsearch/transport/TransportStats.java b/src/main/java/org/elasticsearch/transport/TransportStats.java index 4cf2b27475f..2de980287d6 100644 --- a/src/main/java/org/elasticsearch/transport/TransportStats.java +++ b/src/main/java/org/elasticsearch/transport/TransportStats.java @@ -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; }