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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to