Skip to content

Commit 27f95d8

Browse files
authored
Merge pull request #15 from alongoldboim/support_strings_types
Adding support for metrics strings
2 parents c479461 + 391ee89 commit 27f95d8

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

hawkular/metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class MetricType:
4141
Gauge = 'gauges'
4242
Availability = 'availability'
4343
Counter = 'counters'
44+
String = 'strings'
4445
Rate = 'rate'
4546
_Metrics = 'metrics'
4647

@@ -50,6 +51,8 @@ def short(metric_type):
5051
return 'gauge'
5152
elif metric_type is MetricType.Counter:
5253
return 'counter'
54+
elif metric_type is MetricType.String:
55+
return 'string'
5356
else:
5457
return 'availability'
5558

hawkular/metrics_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ def test_add_availability_single(self):
174174
down = self.client.query_metric(MetricType.Availability, 'test.avail.2')
175175
self.assertEqual(down[0]['value'], Availability.Down)
176176

177+
def test_add_string_single(self):
178+
self.client.push(MetricType.String, 'test.string.1', "foo")
179+
data = self.client.query_metric(MetricType.String, 'test.string.1')
180+
self.assertEqual(data, 'foo')
181+
177182
def test_add_gauge_multi_datapoint(self):
178183
metric_1v = create_datapoint(float(1.45))
179184
metric_2v = create_datapoint(float(2.00), (time_millis() - 2000))

0 commit comments

Comments
 (0)