Skip to content

Commit

Permalink
Merge pull request #17278 from javanna/fix/remove_cluster_stats_os_mem
Browse files Browse the repository at this point in the history
Cluster Stats: remove mem section
  • Loading branch information
javanna committed Mar 24, 2016
2 parents 4b17a5c + ce86fc5 commit 609456a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ public static class OsStats implements ToXContent, Streamable {

int availableProcessors;
int allocatedProcessors;
long availableMemory;
final ObjectIntHashMap<String> names;

public OsStats() {
Expand All @@ -326,15 +325,10 @@ public int getAllocatedProcessors() {
return allocatedProcessors;
}

public ByteSizeValue getAvailableMemory() {
return new ByteSizeValue(availableMemory);
}

@Override
public void readFrom(StreamInput in) throws IOException {
availableProcessors = in.readVInt();
allocatedProcessors = in.readVInt();
availableMemory = in.readLong();
int size = in.readVInt();
names.clear();
for (int i = 0; i < size; i++) {
Expand All @@ -346,7 +340,6 @@ public void readFrom(StreamInput in) throws IOException {
public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(availableProcessors);
out.writeVInt(allocatedProcessors);
out.writeLong(availableMemory);
out.writeVInt(names.size());
for (ObjectIntCursor<String> name : names) {
out.writeString(name.key);
Expand All @@ -365,20 +358,13 @@ static final class Fields {
static final XContentBuilderString ALLOCATED_PROCESSORS = new XContentBuilderString("allocated_processors");
static final XContentBuilderString NAME = new XContentBuilderString("name");
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");
}

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field(Fields.AVAILABLE_PROCESSORS, availableProcessors);
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);
for (ObjectIntCursor<String> name : names) {
builder.startObject();
Expand Down
5 changes: 5 additions & 0 deletions docs/reference/migration/migrate_5_0/java.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,8 @@ requests can now be validated at call time which results in much clearer errors.
==== ExplainRequestBuilder

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()`.
5 changes: 5 additions & 0 deletions docs/reference/migration/migrate_5_0/rest.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
`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.

0 comments on commit 609456a

Please sign in to comment.