Cluster Stats: remove mem section

The available memory metric was always set to `0` since 2.0.beta1 (bug).  was left behind but never set. Turns out the section wasn't that useful, as it would only output the total memory available throughout all nodes in the cluster. We decided to remove the section then.
This commit is contained in:
javanna 2016-03-23 12:29:59 +01:00 committed by Luca Cavanna
parent 4b17a5c73f
commit ce86fc5647
3 changed files with 10 additions and 14 deletions

View File

@ -302,7 +302,6 @@ public class ClusterStatsNodes implements ToXContent, Streamable {
int availableProcessors; int availableProcessors;
int allocatedProcessors; int allocatedProcessors;
long availableMemory;
final ObjectIntHashMap<String> names; final ObjectIntHashMap<String> names;
public OsStats() { public OsStats() {
@ -326,15 +325,10 @@ public class ClusterStatsNodes implements ToXContent, Streamable {
return allocatedProcessors; return allocatedProcessors;
} }
public ByteSizeValue getAvailableMemory() {
return new ByteSizeValue(availableMemory);
}
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
availableProcessors = in.readVInt(); availableProcessors = in.readVInt();
allocatedProcessors = in.readVInt(); allocatedProcessors = in.readVInt();
availableMemory = in.readLong();
int size = in.readVInt(); int size = in.readVInt();
names.clear(); names.clear();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -346,7 +340,6 @@ public class ClusterStatsNodes implements ToXContent, Streamable {
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(availableProcessors); out.writeVInt(availableProcessors);
out.writeVInt(allocatedProcessors); out.writeVInt(allocatedProcessors);
out.writeLong(availableMemory);
out.writeVInt(names.size()); out.writeVInt(names.size());
for (ObjectIntCursor<String> name : names) { for (ObjectIntCursor<String> name : names) {
out.writeString(name.key); out.writeString(name.key);
@ -365,9 +358,6 @@ public class ClusterStatsNodes implements ToXContent, Streamable {
static final XContentBuilderString ALLOCATED_PROCESSORS = new XContentBuilderString("allocated_processors"); static final XContentBuilderString ALLOCATED_PROCESSORS = new XContentBuilderString("allocated_processors");
static final XContentBuilderString NAME = new XContentBuilderString("name"); static final XContentBuilderString NAME = new XContentBuilderString("name");
static final XContentBuilderString NAMES = new XContentBuilderString("names"); static final XContentBuilderString NAMES = new XContentBuilderString("names");
static final XContentBuilderString MEM = new XContentBuilderString("mem");
static final XContentBuilderString TOTAL = new XContentBuilderString("total");
static final XContentBuilderString TOTAL_IN_BYTES = new XContentBuilderString("total_in_bytes");
static final XContentBuilderString COUNT = new XContentBuilderString("count"); static final XContentBuilderString COUNT = new XContentBuilderString("count");
} }
@ -375,10 +365,6 @@ public class ClusterStatsNodes implements ToXContent, Streamable {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field(Fields.AVAILABLE_PROCESSORS, availableProcessors); builder.field(Fields.AVAILABLE_PROCESSORS, availableProcessors);
builder.field(Fields.ALLOCATED_PROCESSORS, allocatedProcessors); builder.field(Fields.ALLOCATED_PROCESSORS, allocatedProcessors);
builder.startObject(Fields.MEM);
builder.byteSizeField(Fields.TOTAL_IN_BYTES, Fields.TOTAL, availableMemory);
builder.endObject();
builder.startArray(Fields.NAMES); builder.startArray(Fields.NAMES);
for (ObjectIntCursor<String> name : names) { for (ObjectIntCursor<String> name : names) {
builder.startObject(); builder.startObject();

View File

@ -299,3 +299,8 @@ requests can now be validated at call time which results in much clearer errors.
==== ExplainRequestBuilder ==== ExplainRequestBuilder
The `setQuery(BytesReference)` method have been removed in favor of using `setQuery(QueryBuilder<?>)` The `setQuery(BytesReference)` method have been removed in favor of using `setQuery(QueryBuilder<?>)`
=== ClusterStatsResponse
Removed the `getMemoryAvailable` method from `OsStats`, which could be previously accessed calling
`clusterStatsResponse.getNodesStats().getOs().getMemoryAvailable()`.

View File

@ -15,3 +15,8 @@ endpoint should be used in lieu of optimize.
The `GET` HTTP verb for `/_forcemerge` is no longer supported, please use the The `GET` HTTP verb for `/_forcemerge` is no longer supported, please use the
`POST` HTTP verb. `POST` HTTP verb.
==== Removed `mem` section from `/_cluster/stats` response
The `mem` section contained only one value, the total memory available
throughout all nodes in the cluster. The section was removed as it didn't
prove useful.