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 2021/01/26 03:05:00 UTC

[GitHub] [spark] HeartSaVioR commented on a change in pull request #31335: [SPARK-34232][CORE] Redact SparkListenerEnvironmentUpdate event in log

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



##########
File path: core/src/main/scala/org/apache/spark/util/ListenerBus.scala
##########
@@ -150,4 +151,14 @@ private[spark] trait ListenerBus[L <: AnyRef, E] extends Logging {
     listeners.asScala.filter(_.getClass == c).map(_.asInstanceOf[T]).toSeq
   }
 
+  private[spark] def redactEvent(e: E): E = {
+    e match {
+      case event: SparkListenerEnvironmentUpdate =>
+        event

Review comment:
       Let's reuse `EventLoggingListener.redactEvent`. Probably change the code in EventLoggingListener like below?
   
   ```
   private[spark] class EventLoggingListener(
   
   ...
   
     private[spark] def redactEvent(
         event: SparkListenerEnvironmentUpdate): SparkListenerEnvironmentUpdate = {
       EventLoggingListener.redactEvent(sparkConf, event)
     }
   }
   
   private[spark] object EventLoggingListener extends Logging {
   
   ...
   
     def redactEvent(
         sparkConf: SparkConf,
         event: SparkListenerEnvironmentUpdate): SparkListenerEnvironmentUpdate = {
       // environmentDetails maps a string descriptor to a set of properties
       // Similar to:
       // "JVM Information" -> jvmInformation,
       // "Spark Properties" -> sparkProperties,
       // ...
       // where jvmInformation, sparkProperties, etc. are sequence of tuples.
       // We go through the various  of properties and redact sensitive information from them.
       val noRedactProps = Seq("Classpath Entries")
       val redactedProps = event.environmentDetails.map {
         case (name, props) if noRedactProps.contains(name) => name -> props
         case (name, props) => name -> Utils.redact(sparkConf, props)
       }
       SparkListenerEnvironmentUpdate(redactedProps)
     }
   }
   ```




----------------------------------------------------------------
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



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