Skip to content

Commit

Permalink
Avoid instrumenting already-instrumented RDDs, as this causes metrics…
Browse files Browse the repository at this point in the history
… to be recorded multiple times
  • Loading branch information
nfergu committed Jan 18, 2015
1 parent a11e07e commit d8e02d9
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import scala.reflect.ClassTag
* calling the `unInstrument` method. For more details and usage instructions see the [[MetricsContext]] class.
*/
class InstrumentedRDDFunctions[T: ClassTag](self: RDD[T]) {
def instrument(): RDD[T] = {
InstrumentedRDD.instrument(self)
def instrument(): RDD[T] = self match {
case instrumentedRDD: InstrumentedRDD[T] => self
case _ => InstrumentedRDD.instrument(self)
}
def unInstrument(): RDD[T] = self match {
case instrumentedRDD: InstrumentedRDD[T] => instrumentedRDD.decoratedRDD
Expand Down

0 comments on commit d8e02d9

Please sign in to comment.