Github user CodingCat commented on the issue:
https://github.com/apache/spark/pull/11994
@jerryshao I mean we also need to provide BaseReporter trait
```scala
trait Sink {
protected val reporter: BaseReporter = createReporter()
def createReporter(): BaseReporter
def report(): Unit = {
reporter.report()
}
}
trait BaseReporter {
def report()
}
class SomeSink extends Sink {
override def createReporter(): BaseReporter = {
}
}
class CodeHaleCsvReporter extends BaseReporter {
val reporter: CsvReporter = CsvReporter.forRegistry(new MetricRegistry())
// if they want to use multiple codehale based reporter, they have to ensure
the singleton
.formatFor(Locale.US)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.convertRatesTo(TimeUnit.SECONDS)
.build(new File(pollDir))
override def report(): Unit = {
reporter.report()
}
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]