Example #1
0
 def __init__(self, point):
     """ timestamp: The timestamp of this snapshot
         duration: The average response time at this time
         total: The total number of hits that were generated
         hits: The number of successful hits
         errors: The number of errors
         timeouts: The number of timeouts
         volume: The concurrency level at this time
         txbytes: The total number of bytes sent
         rxbytes: The total number of bytes received 
         steps: Per-step metric at this point in time """
     
     self.timestamp = point['timestamp'] if 'timestamp' in point else None
     self.duration = point['duration'] if 'duration' in point else None
     self.total = point['total'] if 'total' in point else None
     self.hits = point['executed'] if 'executed' in point else None
     self.errors = point['errors'] if 'errors' in point else None
     self.timeouts = point['timeouts'] if 'timeouts' in point else None
     self.volume = point['volume'] if 'volume' in point else None
     self.txbytes = point['txbytes'] if 'txbytes' in point else None
     self.rxbytes = point['rxbytes'] if 'rxbytes' in point else None
     if 'steps' in point and validate_list(point['steps']):
         def step(s):
             return Step(s)
         self.steps = list(map(step, point['steps']))
     else:
         self.steps = None
Example #2
0
 def _validate(self, options):
     """ Raises a ValidationError if validation fails. """
     
     failed = validate(options)
     if not 'pattern' in options or not 'intervals' in options['pattern'] \
     or not validate_list(options['pattern']['intervals']):
         failed.append('pattern')
     if len(failed) > 0:
         raise ValidationError('Validation error.', failed)
Example #3
0
 def __init__(self, result):
     """ region: The region from which the rush was executed
         timeline: The timeline of the rush containing various statistics."""
     
     self.region = result['region'] if 'region' in result else None
     if 'timeline' in result and validate_list(result['timeline']):
         def point(p):
             return Point(p)
         self.timeline = list(map(point, result['timeline']))
     else:
         self.timeline = None
Example #4
0
    def __init__(self, result):
        """ region: The region from which this sprint was executed
            duration: The overall response time for the successful hit
            steps: Stats about the individual steps """

        self.region = result['region'] if 'region' in result else None
        self.duration = result['duration'] if 'duration' in result else None
        if 'steps' in result and validate_list(result['steps']):
            def step(s):
                return Step(s)
            self.steps = list(map(step, result['steps']))
        else:
            self.steps = None
Example #5
0
    def __init__(self, result):
        """ region: The region from which this sprint was executed
            duration: The overall response time for the successful hit
            steps: Stats about the individual steps """

        self.region = result['region'] if 'region' in result else None
        self.duration = result['duration'] if 'duration' in result else None
        if 'steps' in result and validate_list(result['steps']):
            def step(s):
                return Step(s)
            self.steps = list(map(step, result['steps']))
        else:
            self.steps = None
Example #6
0
    def _validate(self, options):
        """ Raises a ValidationError if validation fails. """
        failed = validate(options)
        if not "url" in options or not validate_url(options["url"]):
            failed.append("url")

        if (
            not "pattern" in options
            or not "intervals" in options["pattern"]
            or not validate_list(options["pattern"]["intervals"])
        ):
            failed.append("pattern")
        if len(failed) > 0:
            raise ValidationError("Validation error.", failed)