예제 #1
0
 def _validate_single_metric(self, metric):
     validation.metric_name(metric['name'])
     assert isinstance(metric['timestamp'], (int, float)), "Timestamp must be a number"
     assert isinstance(metric['value'], (int, long, float)), "Value must be a number"
     if "dimensions" in metric:
         for dimension_key in metric['dimensions']:
             validation.dimension_key(dimension_key)
             validation.dimension_value(metric['dimensions'][dimension_key])
     if "value_meta" in metric:
             validation.validate_value_meta(metric['value_meta'])
예제 #2
0
 def _validate_single_metric(self, metric):
     validation.metric_name(metric['name'])
     assert isinstance(metric['timestamp'], (int, float)), "Timestamp must be a number"
     assert isinstance(metric['value'], (int, long, float)), "Value must be a number"
     if "dimensions" in metric:
         for dimension_key in metric['dimensions']:
             validation.dimension_key(dimension_key)
             validation.dimension_value(metric['dimensions'][dimension_key])
     if "value_meta" in metric:
             validation.validate_value_meta(metric['value_meta'])
예제 #3
0
 def test_valid_value(self):
     value_meta_value = "this.is_a.valid-value"
     value_meta = {'value_meta_name': value_meta_value}
     validation.validate_value_meta(value_meta)
     self.assertTrue(True)
예제 #4
0
 def test_valid_name(self):
     value_meta_name = "this.is_a.valid-name"
     value_meta = {value_meta_name: 'value_meta_value'}
     validation.validate_value_meta(value_meta)
     self.assertTrue(True)
예제 #5
0
 def test_valid_value(self):
     value_meta_value = "this.is_a.valid-value"
     value_meta = {'value_meta_name': value_meta_value}
     validation.validate_value_meta(value_meta)
     self.assertTrue(True)
예제 #6
0
 def test_valid_name(self):
     value_meta_name = "this.is_a.valid-name"
     value_meta = {value_meta_name: 'value_meta_value'}
     validation.validate_value_meta(value_meta)
     self.assertTrue(True)