HeartSaVioR commented on a change in pull request #32934:
URL: https://github.com/apache/spark/pull/32934#discussion_r663587422



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDBFileManager.scala
##########
@@ -134,6 +135,22 @@ class RocksDBFileManager(
     override def accept(path: Path): Boolean = path.toString.endsWith(".zip")
   }
 
+  /**
+   * Metrics for loading checkpoint from DFS. Every loadCheckpointFromDFS call 
will update this
+   * metrics, so this effectively records the latest metrics.
+   */
+  @volatile private var loadCheckpointMetrics = 
RocksDBFileManagerMetrics.EMPTY_METRICS
+
+  /**
+   * Metrics for saving checkpoint to DFS. Every saveCheckpointToDFS call will 
update this
+   * metrics, so this effectively records the latest metrics.
+   */
+  @volatile private var saveCheckpointMetrics = 
RocksDBFileManagerMetrics.EMPTY_METRICS
+
+  def latestloadCheckpointMetrics: RocksDBFileManagerMetrics = 
loadCheckpointMetrics

Review comment:
       nit: latest`L`oadCheckpointMetrics

##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala
##########
@@ -442,6 +476,42 @@ object RocksDBConf {
   def apply(): RocksDBConf = apply(new StateStoreConf())
 }
 
+/** Class to represent stats from each commit. */
+case class RocksDBMetrics(
+  numCommittedKeys: Long,
+  numUncommittedKeys: Long,
+  memUsageBytes: Long,
+  totalSSTFilesBytes: Long,
+  nativeOpsLatencyMicros: Map[String, RocksDBNativeHistogram],
+  lastCommitLatencyMs: Map[String, Long],
+  filesCopied: Long,
+  bytesCopied: Long,
+  filesReused: Long,
+  zipFileBytesUncompressed: Option[Long]) {
+  def json: String = Serialization.write(this)(RocksDBMetrics.format)
+}
+
+object RocksDBMetrics {
+  val format = Serialization.formats(NoTypeHints)
+}
+
+/** Class to wrap RocksDB's native histogram */
+case class RocksDBNativeHistogram(
+  avg: Double, stddev: Double, median: Double, p95: Double, p99: Double) {

Review comment:
       nit: indent

##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDBFileManager.scala
##########
@@ -486,6 +516,23 @@ class RocksDBFileManager(
   }
 }
 
+/**
+ * Metrics regarding RocksDB file sync between local and DFS.
+ */
+case class RocksDBFileManagerMetrics(
+  filesCopied: Long,

Review comment:
       nit: indent

##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala
##########
@@ -442,6 +476,42 @@ object RocksDBConf {
   def apply(): RocksDBConf = apply(new StateStoreConf())
 }
 
+/** Class to represent stats from each commit. */
+case class RocksDBMetrics(
+  numCommittedKeys: Long,

Review comment:
       nit: indent




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to