Class PreprocessorRuleMetrics


  • public class PreprocessorRuleMetrics
    extends Object
    A helper class for instrumenting preprocessor rules. Tracks two counters: number of times the rule has been successfully applied, and counter of CPU time (nanos) spent on applying the rule to troubleshoot possible performance issues.
    Author:
    [email protected]
    • Constructor Detail

      • PreprocessorRuleMetrics

        public PreprocessorRuleMetrics​(@Nullable
                                       com.yammer.metrics.core.Counter ruleAppliedCounter,
                                       @Nullable
                                       com.yammer.metrics.core.Counter ruleCpuTimeNanosCounter,
                                       @Nullable
                                       com.yammer.metrics.core.Counter ruleCheckedCounter)
    • Method Detail

      • incrementRuleAppliedCounter

        public void incrementRuleAppliedCounter()
        Increment ruleAppliedCounter (if available) by 1
      • ruleEnd

        public void ruleEnd​(long ruleStartTime)
        Measure rule execution time and add it to ruleCpuTimeNanosCounter (if available)
        Parameters:
        ruleStartTime - rule start time
      • ruleStart

        public long ruleStart()
        Mark rule start time, increment ruleCheckedCounter (if available) by 1
        Returns:
        start time in nanos