Skip to content

Commit 2ebbf5d

Browse files
committed
Added copyright/license information, renamed query_metric -> query_metrics
1 parent b27a311 commit 2ebbf5d

3 files changed

Lines changed: 57 additions & 6 deletions

File tree

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,26 @@ This repository includes the necessary Python client libraries to access Hawkula
55

66
## Introduction
77

8-
Python client to access Hawkular-Metrics, an abstraction to invoke REST-methods on the server endpoint using urllib2. No external dependencies, works with Python 2.7 (Python 3.x support planned).
8+
Python client to access Hawkular-Metrics, an abstraction to invoke REST-methods on the server endpoint using urllib2. No external dependencies, works with Python 2.7.x and Python 3.4.x (tested with the Python 3.4.2, might work with newer versions also)
9+
10+
## License and copyright
11+
12+
```
13+
Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
14+
and other contributors.
15+
16+
Licensed under the Apache License, Version 2.0 (the "License");
17+
you may not use this file except in compliance with the License.
18+
You may obtain a copy of the License at
19+
20+
http://www.apache.org/licenses/LICENSE-2.0
21+
22+
Unless required by applicable law or agreed to in writing, software
23+
distributed under the License is distributed on an "AS IS" BASIS,
24+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25+
See the License for the specific language governing permissions and
26+
limitations under the License.
27+
```
928

1029
## Installation
1130

hawkular/metrics.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
"""
2+
Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
3+
and other contributors.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
"""
117
from __future__ import unicode_literals
218

319
import codecs
@@ -240,7 +256,7 @@ def push(self, metric_type, metric_id, value, timestamp=None, **tags):
240256
item = create_metric(metric_type, metric_id, create_datapoint(value, timestamp, **tags))
241257
self.put(item)
242258

243-
def query_metric(self, metric_type, metric_id, **search_options):
259+
def query_metrics(self, metric_type, metric_id, **search_options):
244260
"""
245261
Query for metrics from the server.
246262
@@ -257,13 +273,13 @@ def query_single_gauge(self, metric_id, **search_options):
257273
"""
258274
See query_metric
259275
"""
260-
return self.query_metric(MetricType.Gauge, metric_id, **search_options)
276+
return self.query_metrics(MetricType.Gauge, metric_id, **search_options)
261277

262278
def query_single_availability(self, metric_id, **search_options):
263279
"""
264280
See query_metric
265281
"""
266-
return self.query_metric(MetricType.Availability, metric_id, **search_options)
282+
return self.query_metrics(MetricType.Availability, metric_id, **search_options)
267283

268284
def query_definitions(self, query_type):
269285
"""

hawkular/metrics_test.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
"""
2+
Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
3+
and other contributors.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
"""
117
from __future__ import unicode_literals
218

319
import unittest
@@ -201,11 +217,11 @@ def test_query_options(self):
201217
self.client.put(m)
202218

203219
# Query first without limitations
204-
d = self.client.query_metric(MetricType.Gauge, 'test.query.gauge.1')
220+
d = self.client.query_metrics(MetricType.Gauge, 'test.query.gauge.1')
205221
self.assertEqual(2, len(d))
206222

207223
# Query for data which has start time limitation
208-
d = self.client.query_metric(MetricType.Gauge, 'test.query.gauge.1', start=(t-1000))
224+
d = self.client.query_metrics(MetricType.Gauge, 'test.query.gauge.1', start=(t-1000))
209225
self.assertEqual(1, len(d))
210226

211227
# This feature isn't really ready for prime time in Hawkular-Metrics yet..

0 commit comments

Comments
 (0)