(self, name, path, min=None, max=None)
@type name: string
        @param name: rule name, used to identify this rule in Sentry
        @type path: string
        @param path: un-compiled regular expression of the path of the rule
        @type min: string of float/int, int or float. will be convert to float
        @param min: optional minimal value that if value goes below it send
            an alert to Sentry
        @type max: string of float/int, int or float. will be convert to float
        @param max: optional maximal value that if value goes over it send
            an alert to Sentry
def __init__(self, name, path, min=None, max=None):
        """
        @type name: string
        @param name: rule name, used to identify this rule in Sentry
        @type path: string
        @param path: un-compiled regular expression of the path of the rule
        @type min: string of float/int, int or float. will be convert to float
        @param min: optional minimal value that if value goes below it send
            an alert to Sentry
        @type max: string of float/int, int or float. will be convert to float
        @param max: optional maximal value that if value goes over it send
            an alert to Sentry
        """
        self.name = name
        # counters that can be used to debug rule
        self.counter_errors = 0
        self.counter_pass = 0

        # force min and max to be float
        try:
            self.min = float(min)
        except TypeError:
            self.min = None
        try:
            self.max = float(max)
        except TypeError:
            self.max = None

        if self.min is None and self.max is None:
            raise InvalidRule("%s: %s: both min and max are unset or invalid"
                              % (name, path))

        if self.min is not None and self.max is not None:
            if self.min > self.max:
                raise InvalidRule("min %.1f is larger than max %.1f" % (
                    self.min, self.max))

        # compile path regular expression
        self.regexp = re.compile(r'(?P<prefix>.*)\.(?P<path>%s)$' % path)
def __init__ ( self , name , path , min = None , max = None ) : self . name = name # counters that can be used to debug rule self . counter_errors = 0 self . counter_pass = 0 # force min and max to be float try : self . min = float ( min ) except TypeError : self . min = None try : self . max = float ( max ) except TypeError : self . max = None if self . min is None and self . max is None : raise InvalidRule ( "%s: %s: both min and max are unset or invalid" % ( name , path ) ) if self . min is not None and self . max is not None : if self . min > self . max : raise InvalidRule ( "min %.1f is larger than max %.1f" % ( self . min , self . max ) ) # compile path regular expression self . regexp = re . compile ( r'(?P<prefix>.*)\.(?P<path>%s)$' % path )