exceptionMarkerPF
object exceptionMarkerPF
Converts partial function pf into a side-effecting partial function that meters
thrown exceptions for every invocation of pf (for the cases it is defined).
The result is passed unchanged.
Example usage:
class Example extends Instrumented {
val isEven: PartialFunction[Int, String] = {
case x if x % 2 == 0 => x+" is even"
case 5 => throw new IllegalArgumentException("5 is unlucky")
}
val isEvenExceptionMeter = metrics.meter("isEvenExceptions")
val meteredIsEven: PartialFunction[Int, String] = isEvenExceptionMeter.exceptionMarkerPF(isEven)
val sample = 1 to 10
sample collect meteredIsEven // the meter counts 1 exception
}