Skip to content

Commit

Permalink
Merge pull request #15 from alongoldboim/support_strings_types
Browse files Browse the repository at this point in the history
Adding support for metrics strings
  • Loading branch information
burmanm committed Sep 12, 2016
2 parents c479461 + 391ee89 commit 27f95d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hawkular/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class MetricType:
Gauge = 'gauges'
Availability = 'availability'
Counter = 'counters'
String = 'strings'
Rate = 'rate'
_Metrics = 'metrics'

Expand All @@ -50,6 +51,8 @@ def short(metric_type):
return 'gauge'
elif metric_type is MetricType.Counter:
return 'counter'
elif metric_type is MetricType.String:
return 'string'
else:
return 'availability'

Expand Down
5 changes: 5 additions & 0 deletions hawkular/metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ def test_add_availability_single(self):
down = self.client.query_metric(MetricType.Availability, 'test.avail.2')
self.assertEqual(down[0]['value'], Availability.Down)

def test_add_string_single(self):
self.client.push(MetricType.String, 'test.string.1', "foo")
data = self.client.query_metric(MetricType.String, 'test.string.1')
self.assertEqual(data, 'foo')

def test_add_gauge_multi_datapoint(self):
metric_1v = create_datapoint(float(1.45))
metric_2v = create_datapoint(float(2.00), (time_millis() - 2000))
Expand Down

0 comments on commit 27f95d8

Please sign in to comment.