You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celeborn.apache.org by na...@apache.org on 2023/01/05 03:45:23 UTC

[incubator-celeborn] branch main updated: [CELEBORN-168][FOLLOWUP] Device metrics should use long value and add size unit in metric name (#1143)

This is an automated email from the ASF dual-hosted git repository.

nafiyaix pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 5edb21d2 [CELEBORN-168][FOLLOWUP] Device metrics should use long value and add size unit in metric name (#1143)
5edb21d2 is described below

commit 5edb21d210021348b4981a8f0baa584c43da5f09
Author: Angerszhuuuu <an...@gmail.com>
AuthorDate: Thu Jan 5 11:45:19 2023 +0800

    [CELEBORN-168][FOLLOWUP] Device metrics should use long value and add size unit in metric name (#1143)
    
    * [CELEBORN-168][FOLLOWUP] Device metrics should use long value and add size unit in metric name
---
 .../apache/celeborn/service/deploy/worker/WorkerSource.scala   |  8 ++++----
 .../celeborn/service/deploy/worker/storage/DeviceMonitor.scala |  4 ++--
 .../service/deploy/worker/storage/DeviceMonitorSuite.scala     | 10 +++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerSource.scala b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerSource.scala
index b6333d47..0d2144bb 100644
--- a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerSource.scala
+++ b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerSource.scala
@@ -93,8 +93,8 @@ object WorkerSource {
   val PausePushDataAndReplicateCount = "PausePushDataAndReplicate"
 
   // local device
-  val DeviceOSFreeCapacity = "DeviceOSFreeCapacity"
-  val DeviceOSTotalCapacity = "DeviceOSTotalCapacity"
-  val DeviceCelebornFreeCapacity = "DeviceCelebornFreeCapacity"
-  val DeviceCelebornTotalCapacity = "DeviceCelebornTotalCapacity"
+  val DeviceOSFreeCapacity = "DeviceOSFreeCapacity(GB)"
+  val DeviceOSTotalCapacity = "DeviceOSTotalCapacity(GB)"
+  val DeviceCelebornFreeCapacity = "DeviceCelebornFreeCapacity(B)"
+  val DeviceCelebornTotalCapacity = "DeviceCelebornTotalCapacity(B)"
 }
diff --git a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala
index c159c1ab..398ceb99 100644
--- a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala
+++ b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala
@@ -88,10 +88,10 @@ class LocalDeviceMonitor(
         def usage = DeviceMonitor.getDiskUsageInfos(diskInfos.head)
         workerSource.addGauge(
           s"${WorkerSource.DeviceOSTotalCapacity}_${deviceInfo.name}",
-          _ => usage(usage.length - 5))
+          _ => usage(usage.length - 5).toLong)
         workerSource.addGauge(
           s"${WorkerSource.DeviceOSFreeCapacity}_${deviceInfo.name}",
-          _ => usage(usage.length - 3))
+          _ => usage(usage.length - 3).toLong)
         workerSource.addGauge(
           s"${WorkerSource.DeviceCelebornTotalCapacity}_${deviceInfo.name}",
           _ => diskInfos.map(_.configuredUsableSpace).sum)
diff --git a/worker/src/test/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitorSuite.scala b/worker/src/test/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitorSuite.scala
index d8499eec..44f4b00b 100644
--- a/worker/src/test/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitorSuite.scala
+++ b/worker/src/test/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitorSuite.scala
@@ -396,14 +396,14 @@ class DeviceMonitorSuite extends AnyFunSuite {
         _.name.startsWith(WorkerSource.DeviceCelebornFreeCapacity)).sortBy(_.name)
 
       assertEquals(s"${WorkerSource.DeviceOSTotalCapacity}_vda", metrics1.head.name)
-      assertEquals("1300", metrics1.head.gauge.getValue)
+      assertEquals(1300L, metrics1.head.gauge.getValue)
       assertEquals(s"${WorkerSource.DeviceOSTotalCapacity}_vdb", metrics1.last.name)
-      assertEquals("1800", metrics1.last.gauge.getValue)
+      assertEquals(1800L, metrics1.last.gauge.getValue)
 
       assertEquals(s"${WorkerSource.DeviceOSFreeCapacity}_vda", metrics2.head.name)
-      assertEquals("1205", metrics2.head.gauge.getValue)
+      assertEquals(1205L, metrics2.head.gauge.getValue)
       assertEquals(s"${WorkerSource.DeviceOSFreeCapacity}_vdb", metrics2.last.name)
-      assertEquals("1709", metrics2.last.gauge.getValue)
+      assertEquals(1709L, metrics2.last.gauge.getValue)
 
       assertEquals(s"${WorkerSource.DeviceCelebornTotalCapacity}_vda", metrics3.head.name)
       assertEquals(Int.MaxValue.toLong * 2, metrics3.head.gauge.getValue)
@@ -418,7 +418,7 @@ class DeviceMonitorSuite extends AnyFunSuite {
 
       // test if metrics will change when disk usage change, here
       when(Utils.runCommand(dfBCmd1)).thenReturn(dfBOut6)
-      assertEquals("1178", metrics2.head.gauge.getValue)
+      assertEquals(1178L, metrics2.head.gauge.getValue)
     }
   }
 }