Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3466#discussion_r22266250
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/StreamingSource.scala ---
    @@ -28,46 +28,58 @@ private[streaming] class StreamingSource(ssc: 
StreamingContext) extends Source {
     
       private val streamingListener = ssc.progressListener
     
    -  private def registerGauge[T](name: String, f: 
StreamingJobProgressListener => T,
    +  private def registerGauge[T](name: String, f: 
StreamingJobProgressListener => Option[T],
           defaultValue: T) {
         metricRegistry.register(MetricRegistry.name("streaming", name), new 
Gauge[T] {
    -      override def getValue: T = 
Option(f(streamingListener)).getOrElse(defaultValue)
    --- End diff --
    
    I understand the problem. Good catch, I did not realize that. How about 
this. Lets make two versions of registerGauge, one that takes `f: 
StreamingProgressListener => T` without any default value, another that takes 
`f: StreamingProgressListener => Option[T]` and the default value. Each version 
will be used accordingly. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to