@@ -35,20 +35,20 @@ def test_tenant_creation_with_retentions_and_aggregations(self):
3535class MetricsTestCase (TestMetricFunctionsBase ):
3636 """
3737 Test metric functionality, both adding definition and querying for definition,
38- as well as adding new numeric and availability metrics.
38+ as well as adding new gauge and availability metrics.
3939
4040 Metric definition creation should also test fetching the definition, while
4141 metric inserts should test also fetching the metric data.
4242 """
4343
44- def test_numeric_creation (self ):
44+ def test_gauge_creation (self ):
4545 """
46- Test creating numeric metric definitions with different tags and definition.
46+ Test creating gauge metric definitions with different tags and definition.
4747 """
48- # Create numeric metrics with empty details and added details
49- md1 = self .client .create_numeric_definition ('test.create.numeric .1' )
50- md2 = self .client .create_numeric_definition ('test.create.numeric .2' , dataRetention = 90 )
51- md3 = self .client .create_numeric_definition ('test.create.numeric .3' , dataRetention = 90 , units = 'bytes' , env = 'qa' )
48+ # Create gauge metrics with empty details and added details
49+ md1 = self .client .create_gauge_definition ('test.create.gauge .1' )
50+ md2 = self .client .create_gauge_definition ('test.create.gauge .2' , dataRetention = 90 )
51+ md3 = self .client .create_gauge_definition ('test.create.gauge .3' , dataRetention = 90 , units = 'bytes' , env = 'qa' )
5252 self .assertTrue (md1 )
5353 self .assertTrue (md2 )
5454 self .assertTrue (md3 )
@@ -61,16 +61,16 @@ def test_numeric_creation(self):
6161
6262 # This is what the returned dict should look like
6363 expect = [
64- {'id' : 'test.create.numeric .1' ,
64+ {'id' : 'test.create.gauge .1' ,
6565 'tenantId' : self .test_tenant },
66- {'dataRetention' : 90 , 'id' : 'test.create.numeric .2' , 'tenantId' : self .test_tenant },
66+ {'dataRetention' : 90 , 'id' : 'test.create.gauge .2' , 'tenantId' : self .test_tenant },
6767 {'tags' : {'units' : 'bytes' , 'env' : 'qa' },
68- 'id' : 'test.create.numeric .3' , 'dataRetention' : 90 , 'tenantId' : self .test_tenant }]
68+ 'id' : 'test.create.gauge .3' , 'dataRetention' : 90 , 'tenantId' : self .test_tenant }]
6969
7070 self .assertEqual (m , expect ) # Did it?
7171
7272 # Lets try creating a duplicate metric
73- md4 = self .client .create_numeric_definition ('test.create.numeric .1' )
73+ md4 = self .client .create_gauge_definition ('test.create.gauge .1' )
7474 self .assertFalse (md4 , 'Should have received an exception, metric with the same name was already created' )
7575
7676 def test_availability_creation (self ):
@@ -87,7 +87,7 @@ def test_availability_creation(self):
8787 def test_tags_modifications (self ):
8888 m = 'test.create.tags.1'
8989 # Create metric without tags
90- self .client .create_numeric_definition (m )
90+ self .client .create_gauge_definition (m )
9191 e = self .client .query_metric_tags (MetricType .Gauge , m )
9292 self .assertIsNotNone (e )
9393 self .assertEqual ({}, e )
@@ -107,30 +107,30 @@ def test_tags_modifications(self):
107107 # print 'START: TEST TAGS'
108108 # metric = float(1.2345)
109109 # print 'CREATE'
110- # self.client.create_numeric_definition ('test.numeric .single.tags.1', hostname='')
110+ # self.client.create_gauge_definition ('test.gauge .single.tags.1', hostname='')
111111 # print 'POST'
112- # self.client.push('test.numeric .single.tags.1', metric, hostname='localhost')
112+ # self.client.push('test.gauge .single.tags.1', metric, hostname='localhost')
113113 # print 'GET'
114- # data = self.client.query_single_numeric ('test.numeric .single.tags.1')
114+ # data = self.client.query_single_gauge ('test.gauge .single.tags.1')
115115 # print data
116116 # print 'END: TEST TAGS'
117117
118- def test_add_numeric_single (self ):
118+ def test_add_gauge_single (self ):
119119 # Normal way
120120 value = float (4.35 )
121121 datapoint = create_datapoint (value , time_millis ())
122- metric = create_metric (MetricType .Gauge , 'test.numeric ./' , datapoint )
122+ metric = create_metric (MetricType .Gauge , 'test.gauge ./' , datapoint )
123123 self .client .put (metric )
124124
125125 # Fetch results
126- data = self .client .query_single_numeric ('test.numeric ./' )
126+ data = self .client .query_single_gauge ('test.gauge ./' )
127127 self .assertEqual (float (data [0 ]['value' ]), value )
128128
129129 # Shortcut method with tags
130- self .client .push (MetricType .Gauge , 'test.numeric .single.tags' , value , hostname = 'localhost' )
130+ self .client .push (MetricType .Gauge , 'test.gauge .single.tags' , value , hostname = 'localhost' )
131131
132132 # Fetch results
133- data = self .client .query_single_numeric ('test.numeric .single.tags' )
133+ data = self .client .query_single_gauge ('test.gauge .single.tags' )
134134 self .assertEqual (value , float (data [0 ]['value' ]))
135135 # self.assertEqual(data[0]['tags']['localhost'], 'localhost')
136136
@@ -144,14 +144,14 @@ def test_add_availability_single(self):
144144 down = self .client .query_single_availability ('test.avail.2' )
145145 self .assertEqual (down [0 ]['value' ], Availability .Down )
146146
147- def test_add_numeric_multi_datapoint (self ):
147+ def test_add_gauge_multi_datapoint (self ):
148148 metric_1v = create_datapoint (float (1.45 ))
149149 metric_2v = create_datapoint (float (2.00 ), (time_millis () - 2000 ))
150150
151- metric = create_metric (MetricType .Gauge , 'test.numeric .multi' , [metric_1v , metric_2v ])
151+ metric = create_metric (MetricType .Gauge , 'test.gauge .multi' , [metric_1v , metric_2v ])
152152 self .client .put (metric )
153153
154- data = self .client .query_single_numeric ('test.numeric .multi' )
154+ data = self .client .query_single_gauge ('test.gauge .multi' )
155155 self .assertEqual (len (data ), 2 )
156156 self .assertEqual (data [0 ]['value' ], float (1.45 ))
157157 self .assertEqual (data [1 ]['value' ], float (2.00 ))
@@ -174,16 +174,16 @@ def test_add_mixed_metrics_and_datapoints(self):
174174 metric1 = create_datapoint (float (1.45 ))
175175 metric1_2 = create_datapoint (float (2.00 ), (time_millis () - 2000 ))
176176
177- metric_multi = create_metric (MetricType .Gauge , 'test.multi.numeric .1' , [metric1 , metric1_2 ])
177+ metric_multi = create_metric (MetricType .Gauge , 'test.multi.gauge .1' , [metric1 , metric1_2 ])
178178
179179 metric2 = create_datapoint (Availability .Up )
180- metric2_multi = create_metric (MetricType .Availability ,'test.multi.numeric .2' , [metric2 ])
180+ metric2_multi = create_metric (MetricType .Availability ,'test.multi.gauge .2' , [metric2 ])
181181
182182 self .client .put ([metric_multi , metric2_multi ])
183183
184184 # Check that both were added correctly..
185- metric1_data = self .client .query_single_numeric ('test.multi.numeric .1' )
186- metric2_data = self .client .query_single_availability ('test.multi.numeric .2' )
185+ metric1_data = self .client .query_single_gauge ('test.multi.gauge .1' )
186+ metric2_data = self .client .query_single_availability ('test.multi.gauge .2' )
187187
188188 self .assertEqual (2 , len (metric1_data ))
189189 self .assertEqual (1 , len (metric2_data ))
@@ -194,15 +194,15 @@ def test_query_options(self):
194194 v1 = create_datapoint (float (1.45 ), t )
195195 v2 = create_datapoint (float (2.00 ), (t - 2000 ))
196196
197- m = create_metric (MetricType .Gauge , 'test.query.numeric .1' , [v1 , v2 ])
197+ m = create_metric (MetricType .Gauge , 'test.query.gauge .1' , [v1 , v2 ])
198198 self .client .put (m )
199199
200200 # Query first without limitations
201- d = self .client .query_metric (MetricType .Gauge , 'test.query.numeric .1' )
201+ d = self .client .query_metric (MetricType .Gauge , 'test.query.gauge .1' )
202202 self .assertEqual (2 , len (d ))
203203
204204 # Query for data which has start time limitation
205- d = self .client .query_metric (MetricType .Gauge , 'test.query.numeric .1' , start = (t - 1000 ))
205+ d = self .client .query_metric (MetricType .Gauge , 'test.query.gauge .1' , start = (t - 1000 ))
206206 self .assertEqual (1 , len (d ))
207207
208208 # This feature isn't really ready for prime time in Hawkular-Metrics yet..
0 commit comments