You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/18 16:05:11 UTC

[GitHub] [spark] attilapiros commented on a change in pull request #24132: [SPARK-27189][CORE] Add executor-level memory usage metrics to the metrics system

attilapiros commented on a change in pull request #24132: [SPARK-27189][CORE] Add executor-level memory usage metrics to the metrics system
URL: https://github.com/apache/spark/pull/24132#discussion_r266517220
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/metrics/source/MemorySource.scala
 ##########
 @@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.metrics.source
+
+import com.codahale.metrics.MetricRegistry
+
+import org.apache.spark.executor.ExecutorMetrics
+
+private[spark] class MemorySource extends Source {
+
+  override val metricRegistry = new MetricRegistry()
+  override val sourceName = "MemoryMetrics"
+
+  val METRIC_JVM_HEAP_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("JVMHeapMemory"))
+  val METRIC_JVM_OFF_HEAP_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("JVMOffHeapMemory"))
+  val METRIC_JVM_ON_HEAP_EXECUTION_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("OnHeapExecutionMemory"))
+  val METRIC_JVM_ON_HEAP_STORAGE_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("OnHeapStorageMemory"))
+  val METRIC_JVM_ON_HEAP_UNIFIED_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("OnHeapUnifiedMemory"))
+  val METRIC_JVM_OFF_HEAP_EXECUTION_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("OffHeapExecutionMemory"))
+  val METRIC_JVM_OFF_HEAP_STORAGE_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("OffHeapStorageMemory"))
+  val METRIC_JVM_OFF_HEAP_UNIFIED_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("OffHeapUnifiedMemory"))
+  val METRIC_JVM_DIRECT_POOL_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("DirectPoolMemory"))
+  val METRIC_JVM_MAPPED_POOL_MEMORY =
+    metricRegistry.counter(MetricRegistry.name("MappedPoolMemory"))
+
+  // GarbageCollectionMetrics
+  val METRIC_MINOR_GC_COUNT =
+    metricRegistry.counter(MetricRegistry.name("MinorGCCount"))
+  val METRIC_MINOR_GC_TIME =
+    metricRegistry.counter(MetricRegistry.name("MinorGCTime"))
+  val METRIC_MAJOR_GC_COUNT =
+    metricRegistry.counter(MetricRegistry.name("MajorGCCount"))
+  val METRIC_MAJOR_GC_TIME =
+    metricRegistry.counter(MetricRegistry.name("MajorGCTime"))
+
+  // ProcessTreeMetrics
+  val METRIC_PROCESS_TREE_JVM_VMEMORY =
+    metricRegistry.counter(MetricRegistry.name("ProcessTreeJVMVMemory"))
+  val METRIC_PROCESS_TREE_JVM_RSSMEMORY =
+    metricRegistry.counter(MetricRegistry.name("ProcessTreeJVMRSSMemory"))
+  val METRIC_PROCESS_TREE_PYTHON_VMEMORY =
+    metricRegistry.counter(MetricRegistry.name("ProcessTreePythonVMemory"))
+  val METRIC_PROCESS_TREE_PYTHON_RSSMEMORY =
+    metricRegistry.counter(MetricRegistry.name("ProcessTreePythonRSSMemory"))
+  val METRIC_PROCESS_TREE_OTHER_VMEMORY =
+    metricRegistry.counter(MetricRegistry.name("ProcessTreeOtherVMemory"))
+  val METRIC_PROCESS_TREE_OTHER_RSSMEMORY =
+    metricRegistry.counter(MetricRegistry.name("ProcessTreeOtherRSSMemory"))
+
+  def updateCounters(memorySource: MemorySource,
 
 Review comment:
   The updateCounters is a member function and it should use the counters of the its own instance so the `memorySource` argument is not needed.
   
   This way `memorySource.updateCounters(memorySource, executorUpdates)` will be just `memorySource.updateCounters(executorUpdates)`
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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