Skip to content

Commit

Permalink
Add an usage key to the CPU section of OsStats.toXContent.
Browse files Browse the repository at this point in the history
 This is just the sum of existing `sys` and `user`

Closes elastic#4374
  • Loading branch information
bleskes committed Dec 7, 2013
1 parent f68d1a0 commit 9b30e3f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/elasticsearch/monitor/os/OsStats.java
Expand Up @@ -116,6 +116,7 @@ static final class Fields {
static final XContentBuilderString CPU = new XContentBuilderString("cpu");
static final XContentBuilderString SYS = new XContentBuilderString("sys");
static final XContentBuilderString USER = new XContentBuilderString("user");
static final XContentBuilderString USAGE = new XContentBuilderString("usage");
static final XContentBuilderString IDLE = new XContentBuilderString("idle");
static final XContentBuilderString STOLEN = new XContentBuilderString("stolen");

Expand Down Expand Up @@ -165,6 +166,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.field(Fields.SYS, cpu.sys());
builder.field(Fields.USER, cpu.user());
builder.field(Fields.IDLE, cpu.idle());
builder.field(Fields.USAGE, cpu.user() + cpu.sys());
builder.field(Fields.STOLEN, cpu.stolen());
builder.endObject();
}
Expand Down

0 comments on commit 9b30e3f

Please sign in to comment.