|
@@ -24,6 +24,7 @@ import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
|
|
import org.apache.hadoop.metrics2.lib.MutableCounterInt;
|
|
|
import org.apache.hadoop.metrics2.lib.MutableGaugeInt;
|
|
|
import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
|
|
|
+import org.apache.hadoop.metrics2.lib.MutableGaugeFloat;
|
|
|
import org.apache.hadoop.metrics2.lib.MutableRate;
|
|
|
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
|
|
import org.apache.hadoop.yarn.api.records.Resource;
|
|
@@ -77,6 +78,18 @@ public class NodeManagerMetrics {
|
|
|
MutableGaugeLong publicBytesDeleted;
|
|
|
@Metric("# of bytes deleted from the private local cache")
|
|
|
MutableGaugeLong privateBytesDeleted;
|
|
|
+ @Metric("Current used physical memory by all containers in GB")
|
|
|
+ MutableGaugeInt containerUsedMemGB;
|
|
|
+ @Metric("Current used virtual memory by all containers in GB")
|
|
|
+ MutableGaugeInt containerUsedVMemGB;
|
|
|
+ @Metric("Aggregated CPU utilization of all containers")
|
|
|
+ MutableGaugeFloat containerCpuUtilization;
|
|
|
+ @Metric("Current used memory by this node in GB")
|
|
|
+ MutableGaugeInt nodeUsedMemGB;
|
|
|
+ @Metric("Current used virtual memory by this node in GB")
|
|
|
+ MutableGaugeInt nodeUsedVMemGB;
|
|
|
+ @Metric("Current CPU utilization")
|
|
|
+ MutableGaugeFloat nodeCpuUtilization;
|
|
|
|
|
|
// CHECKSTYLE:ON:VisibilityModifier
|
|
|
|
|
@@ -316,4 +329,52 @@ public class NodeManagerMetrics {
|
|
|
public long getPrivateBytesDeleted() {
|
|
|
return this.privateBytesDeleted.value();
|
|
|
}
|
|
|
+
|
|
|
+ public void setContainerUsedMemGB(long usedMem) {
|
|
|
+ this.containerUsedMemGB.set((int)Math.floor(usedMem/1024d));
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getContainerUsedMemGB() {
|
|
|
+ return this.containerUsedMemGB.value();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setContainerUsedVMemGB(long usedVMem) {
|
|
|
+ this.containerUsedVMemGB.set((int)Math.floor(usedVMem/1024d));
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getContainerUsedVMemGB() {
|
|
|
+ return this.containerUsedVMemGB.value();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setContainerCpuUtilization(float cpuUtilization) {
|
|
|
+ this.containerCpuUtilization.set(cpuUtilization);
|
|
|
+ }
|
|
|
+
|
|
|
+ public float getContainerCpuUtilization() {
|
|
|
+ return this.containerCpuUtilization.value();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setNodeUsedMemGB(long totalUsedMemGB) {
|
|
|
+ this.nodeUsedMemGB.set((int)Math.floor(totalUsedMemGB/1024d));
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getNodeUsedMemGB() {
|
|
|
+ return nodeUsedMemGB.value();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setNodeUsedVMemGB(long totalUsedVMemGB) {
|
|
|
+ this.nodeUsedVMemGB.set((int)Math.floor(totalUsedVMemGB/1024d));
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getNodeUsedVMemGB() {
|
|
|
+ return nodeUsedVMemGB.value();
|
|
|
+ }
|
|
|
+
|
|
|
+ public float getNodeCpuUtilization() {
|
|
|
+ return nodeCpuUtilization.value();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setNodeCpuUtilization(float cpuUtilization) {
|
|
|
+ this.nodeCpuUtilization.set(cpuUtilization);
|
|
|
+ }
|
|
|
}
|