From b7d6cce4c9432db322e1e1c6249151af2dfe0b59 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Sat, 7 Dec 2013 21:12:30 +0100 Subject: [PATCH] Add an `usage` key to the CPU section of OsStats.toXContent. This is just the sum of existing `sys` and `user` Closes #4374 --- src/main/java/org/elasticsearch/monitor/os/OsStats.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/elasticsearch/monitor/os/OsStats.java b/src/main/java/org/elasticsearch/monitor/os/OsStats.java index a83edaed073..e79e1a64e77 100644 --- a/src/main/java/org/elasticsearch/monitor/os/OsStats.java +++ b/src/main/java/org/elasticsearch/monitor/os/OsStats.java @@ -116,6 +116,7 @@ public class OsStats implements Streamable, Serializable, ToXContent { 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"); @@ -165,6 +166,7 @@ public class OsStats implements Streamable, Serializable, ToXContent { 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(); }