Skip to content

Commit 18edce4

Browse files
committed
Fix documentation following the 0.3.3-SNAPSHOT changes
1 parent b0c9f1b commit 18edce4

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ See metrics_test.py for more detailed examples. The tests target a running docke
2121

2222
### General
2323

24-
When a method wants a metric_type one can use the shortcuts of MetricType.Numeric or MetricType.Availability. For availability values, one can use Availability.Up and Availability.Down to simplify usage.
24+
When a method wants a metric_type one can use the shortcuts of MetricType.Gauge or MetricType.Availability. For availability values, one can use Availability.Up and Availability.Down to simplify usage.
2525

2626
```python
2727
>>> from hawkular.metrics import *
@@ -36,7 +36,8 @@ Example:
3636

3737
```python
3838
>>> client.create_numeric_definition('example.metric.1', dataRetention=90, units='bytes', hostname='localhost')
39-
>>> client.query_definitions(metrics.MetricType.Numeric)
39+
True
40+
>>> client.query_definitions(metrics.MetricType.Gauge)
4041
[{u'tags': {u'units': u'bytes', u'hostname': u'localhost'}, u'id': u'example.metric.1', u'dataRetention': 90, u'tenantId': u'doc'}]
4142
```
4243

@@ -48,13 +49,13 @@ Example:
4849

4950
```python
5051
>>> client.create_numeric_definition('example.metric.1', dataRetention=90, units='bytes', hostname='localhost')
51-
>>> client.query_metric_tags(MetricType.Numeric, 'example.metric.1')
52+
>>> client.query_metric_tags(MetricType.Gauge, 'example.metric.1')
5253
{u'units': u'bytes', u'hostname': u'localhost'}
53-
>>> client.delete_metric_tags(MetricType.Numeric, 'example.metric.1', units='bytes')
54-
>>> client.query_metric_tags(MetricType.Numeric, 'example.metric.1')
54+
>>> client.delete_metric_tags(MetricType.Gauge, 'example.metric.1', units='bytes')
55+
>>> client.query_metric_tags(MetricType.Gauge, 'example.metric.1')
5556
{u'hostname': u'localhost'}
56-
>>> client.update_metric_tags(MetricType.Numeric, 'example.metric.1', hostname='machine1', env='test')
57-
>>> client.query_metric_tags(MetricType.Numeric, 'example.metric.1')
57+
>>> client.update_metric_tags(MetricType.Gauge, 'example.metric.1', hostname='machine1', env='test')
58+
>>> client.query_metric_tags(MetricType.Gauge, 'example.metric.1')
5859
{u'hostname': u'machine1', u'env': u'test'}
5960
```
6061

@@ -66,23 +67,23 @@ Example pushing a single value:
6667

6768
```python
6869
datapoint = create_datapoint(float(4.35), time_millis())
69-
metric = create_metric('example.metric.1', datapoint)
70-
client.put(MetricType.Numeric, metric)
70+
metric = create_metric(MetricType.Gauge, 'example.metric.1', datapoint)
71+
client.put(metric)
7172
```
7273

7374
And a shortcut method for the above:
7475

7576
```python
76-
client.push(MetricType.Numeric, 'example.metric.1', float(4.35))
77+
client.push(MetricType.Gauge, 'example.metric.1', float(4.35))
7778
```
7879

7980
Example pushing multiple values for the same metric (with given timestamp and without):
8081

8182
```python
8283
>>> v1 = create_datapoint(float(2.345)) # Timestamp is autogenerated
8384
>>> v2 = create_datapoint(float(3.45), 1429711362289) # Timestamp is given
84-
>>> m = create_metric('example.metric.2', [v1, v2])
85-
>>> client.put(MetricType.Numeric, m)
85+
>>> m = create_metric(MetricType.Gauge, 'example.metric.2', [v1, v2])
86+
>>> client.put(m)
8687
>>> client.query_single_numeric('example.metric.2')
8788
[{u'timestamp': 1429711362289, u'value': 3.45}, {u'timestamp': 1429711311895, u'value': 2.345}]
8889
```
@@ -94,11 +95,11 @@ To push multiple metrics with multiple values per metric, see metrics_test.py an
9495
Querying metrics is limited to just metric_id querying now with given search_options. Search for tagged data is coming up later. The supported parameters are ``start``, ``end``, ``buckets``, ``bucketDuration`` and ``distinct``. The returned data structure will change depending on the given parameters.
9596

9697
```python
97-
>>> c.query_metric(MetricType.Numeric, 'test.query.numeric.1')
98+
>>> c.query_metric(MetricType.Gauge, 'test.query.numeric.1')
9899
[{u'timestamp': 1429816731689, u'value': 1.45}, {u'timestamp': 1429816729689, u'value': 2.0}]
99-
>>> c.query_metric(MetricType.Numeric, 'test.query.numeric.1', start=1429816731689)
100+
>>> c.query_metric(MetricType.Gauge, 'test.query.numeric.1', start=1429816731689)
100101
[{u'timestamp': 1429816731689, u'value': 1.45}]
101-
>>> c.query_metric(MetricType.Numeric, 'test.query.numeric.1', buckets=1)
102+
>>> c.query_metric(MetricType.Gauge, 'test.query.numeric.1', buckets=1)
102103
[{u'end': 1429816997651, u'min': 1.45, u'max': 2.0, u'median': 1.725, u'value': u'NaN', u'start': 1429788197651, u'avg': 1.725, u'empty': False, u'percentile95th': 2.0}]
103104
```
104105

0 commit comments

Comments
 (0)