Browse Source

Remove transformers from the codebase

Since data frames are now handled as objects, transformers are no longer
required. This simplifies the global codebase.

Story: 2005890
Task: 36075
Change-Id: I76d9117bd95d80e51ca95804c999f145e65c3a2d
tags/11.0.0
Luka Peschke 2 months ago
parent
commit
492ec063a7

+ 5
- 37
cloudkitty/collector/__init__.py View File

@@ -31,7 +31,6 @@ from voluptuous import Optional
31 31
 from voluptuous import Required
32 32
 from voluptuous import Schema
33 33
 
34
-from cloudkitty import transformer
35 34
 from cloudkitty import utils as ck_utils
36 35
 
37 36
 
@@ -101,15 +100,12 @@ METRIC_BASE_SCHEMA = {
101 100
 }
102 101
 
103 102
 
104
-def get_collector(transformers=None):
103
+def get_collector():
105 104
     metrics_conf = ck_utils.load_conf(CONF.collect.metrics_conf)
106
-    if not transformers:
107
-        transformers = transformer.get_transformers()
108 105
     collector_args = {
109 106
         'period': CONF.collect.period,
110
-        'transformers': transformers,
107
+        'conf': metrics_conf,
111 108
     }
112
-    collector_args.update({'conf': metrics_conf})
113 109
     return driver.DriverManager(
114 110
         COLLECTORS_NAMESPACE,
115 111
         CONF.collect.collector,
@@ -132,7 +128,6 @@ def get_metrics_based_collector_metadata():
132 128
     Results are based on enabled collector and metrics in CONF.
133 129
     """
134 130
     metrics_conf = ck_utils.load_conf(CONF.collect.metrics_conf)
135
-    transformers = transformer.get_transformers()
136 131
     collector = get_collector_without_invoke()
137 132
     metadata = {}
138 133
     if 'metrics' in metrics_conf:
@@ -140,23 +135,11 @@ def get_metrics_based_collector_metadata():
140 135
             alt_name = metric.get('alt_name', metric_name)
141 136
             metadata[alt_name] = collector.get_metadata(
142 137
                 metric_name,
143
-                transformers,
144 138
                 metrics_conf,
145 139
             )
146 140
     return metadata
147 141
 
148 142
 
149
-class TransformerDependencyError(Exception):
150
-    """Raised when a collector can't find a mandatory transformer."""
151
-
152
-    def __init__(self, collector, transformer):
153
-        super(TransformerDependencyError, self).__init__(
154
-            "Transformer '%s' not found, but required by %s" % (transformer,
155
-                                                                collector))
156
-        self.collector = collector
157
-        self.transformer = transformer
158
-
159
-
160 143
 class NoDataCollected(Exception):
161 144
     """Raised when the collection returned no data.
162 145
 
@@ -173,11 +156,9 @@ class NoDataCollected(Exception):
173 156
 @six.add_metaclass(abc.ABCMeta)
174 157
 class BaseCollector(object):
175 158
     collector_name = None
176
-    dependencies = ['CloudKittyFormatTransformer']
177 159
 
178
-    def __init__(self, transformers, **kwargs):
160
+    def __init__(self, **kwargs):
179 161
         try:
180
-            self.transformers = transformers
181 162
             self.period = kwargs['period']
182 163
             self.conf = self.check_configuration(kwargs['conf'])
183 164
         except KeyError as e:
@@ -188,18 +169,6 @@ class BaseCollector(object):
188 169
             LOG.error('Problem while checking configurations.', v)
189 170
             raise v
190 171
 
191
-        self._check_transformers()
192
-        self.t_cloudkitty = self.transformers['CloudKittyFormatTransformer']
193
-
194
-    def _check_transformers(self):
195
-        """Check for transformer prerequisites
196
-
197
-        """
198
-        for dependency in self.dependencies:
199
-            if dependency not in self.transformers:
200
-                raise TransformerDependencyError(self.collector_name,
201
-                                                 dependency)
202
-
203 172
     @staticmethod
204 173
     def check_configuration(conf):
205 174
         """Checks and validates metric configuration.
@@ -229,7 +198,7 @@ class BaseCollector(object):
229 198
         return trans_resource
230 199
 
231 200
     @classmethod
232
-    def get_metadata(cls, resource_name, transformers):
201
+    def get_metadata(cls, resource_name):
233 202
         """Return metadata about collected resource as a dict.
234 203
 
235 204
            Dict object should contain:
@@ -247,8 +216,7 @@ class BaseCollector(object):
247 216
         provided in the metric conf at initialization.
248 217
         (Available in ``self.conf['groupby']`` and ``self.conf['metadata']``).
249 218
 
250
-        Returns a list of items formatted with
251
-        ``CloudKittyFormatTransformer.format_item``.
219
+        Returns a list of cloudkitty.dataframe.DataPoint objects.
252 220
 
253 221
         :param metric_name: Name of the metric to fetch
254 222
         :type metric_name: str

+ 10
- 10
cloudkitty/collector/gnocchi.py View File

@@ -29,6 +29,7 @@ from voluptuous import Required
29 29
 from voluptuous import Schema
30 30
 
31 31
 from cloudkitty import collector
32
+from cloudkitty import dataframe
32 33
 from cloudkitty import utils as ck_utils
33 34
 
34 35
 
@@ -116,8 +117,8 @@ class GnocchiCollector(collector.BaseCollector):
116 117
 
117 118
     collector_name = 'gnocchi'
118 119
 
119
-    def __init__(self, transformers, **kwargs):
120
-        super(GnocchiCollector, self).__init__(transformers, **kwargs)
120
+    def __init__(self, **kwargs):
121
+        super(GnocchiCollector, self).__init__(**kwargs)
121 122
 
122 123
         adapter_options = {'connect_retries': 3}
123 124
         if CONF.collector_gnocchi.gnocchi_auth_type == 'keystone':
@@ -164,9 +165,8 @@ class GnocchiCollector(collector.BaseCollector):
164 165
         return output
165 166
 
166 167
     @classmethod
167
-    def get_metadata(cls, resource_name, transformers, conf):
168
-        info = super(GnocchiCollector, cls).get_metadata(resource_name,
169
-                                                         transformers)
168
+    def get_metadata(cls, resource_name, conf):
169
+        info = super(GnocchiCollector, cls).get_metadata(resource_name)
170 170
         try:
171 171
             info["metadata"].extend(
172 172
                 conf[resource_name]['groupby']
@@ -392,11 +392,11 @@ class GnocchiCollector(collector.BaseCollector):
392 392
                             project_id, start, end, e),
393 393
                     )
394 394
                     continue
395
-                data = self.t_cloudkitty.format_item(
395
+                formated_resources.append(dataframe.DataPoint(
396
+                    met['unit'],
397
+                    qty,
398
+                    0,
396 399
                     groupby,
397 400
                     metadata,
398
-                    met['unit'],
399
-                    qty=qty,
400
-                )
401
-                formated_resources.append(data)
401
+                ))
402 402
         return formated_resources

+ 12
- 15
cloudkitty/collector/monasca.py View File

@@ -25,7 +25,7 @@ from voluptuous import Required
25 25
 from voluptuous import Schema
26 26
 
27 27
 from cloudkitty import collector
28
-from cloudkitty import transformer
28
+from cloudkitty import dataframe
29 29
 from cloudkitty import utils as ck_utils
30 30
 
31 31
 
@@ -94,8 +94,8 @@ class MonascaCollector(collector.BaseCollector):
94 94
 
95 95
         return output
96 96
 
97
-    def __init__(self, transformers, **kwargs):
98
-        super(MonascaCollector, self).__init__(transformers, **kwargs)
97
+    def __init__(self, **kwargs):
98
+        super(MonascaCollector, self).__init__(**kwargs)
99 99
 
100 100
         self.auth = ks_loading.load_auth_from_conf_options(
101 101
             CONF,
@@ -129,7 +129,7 @@ class MonascaCollector(collector.BaseCollector):
129 129
                 return endpoint.url
130 130
         return None
131 131
 
132
-    def _get_metadata(self, metric_name, transformers, conf):
132
+    def _get_metadata(self, metric_name, conf):
133 133
         info = {}
134 134
         info['unit'] = conf['metrics'][metric_name]['unit']
135 135
 
@@ -141,12 +141,9 @@ class MonascaCollector(collector.BaseCollector):
141 141
     # NOTE(lukapeschke) if anyone sees a better way to do this,
142 142
     # please make a patch
143 143
     @classmethod
144
-    def get_metadata(cls, resource_type, transformers, conf):
145
-        args = {
146
-            'transformers': transformer.get_transformers(),
147
-            'period': conf['period']}
148
-        tmp = cls(**args)
149
-        return tmp._get_metadata(resource_type, transformers, conf)
144
+    def get_metadata(cls, resource_type, conf):
145
+        tmp = cls(period=conf['period'])
146
+        return tmp._get_metadata(resource_type, conf)
150 147
 
151 148
     def _get_dimensions(self, metric_name, project_id, q_filter):
152 149
         dimensions = {}
@@ -267,11 +264,11 @@ class MonascaCollector(collector.BaseCollector):
267 264
             if len(d['statistics']):
268 265
                 metadata, groupby, qty = self._format_data(
269 266
                     met, d, resources_info)
270
-                data = self.t_cloudkitty.format_item(
267
+                formated_resources.append(dataframe.DataPoint(
268
+                    met['unit'],
269
+                    qty,
270
+                    0,
271 271
                     groupby,
272 272
                     metadata,
273
-                    met['unit'],
274
-                    qty=qty,
275
-                )
276
-                formated_resources.append(data)
273
+                ))
277 274
         return formated_resources

+ 8
- 8
cloudkitty/collector/prometheus.py View File

@@ -26,6 +26,7 @@ from cloudkitty import collector
26 26
 from cloudkitty.collector.exceptions import CollectError
27 27
 from cloudkitty.common.prometheus_client import PrometheusClient
28 28
 from cloudkitty.common.prometheus_client import PrometheusResponseError
29
+from cloudkitty import dataframe
29 30
 from cloudkitty import utils as ck_utils
30 31
 
31 32
 
@@ -76,8 +77,8 @@ PROMETHEUS_EXTRA_SCHEMA = {
76 77
 class PrometheusCollector(collector.BaseCollector):
77 78
     collector_name = 'prometheus'
78 79
 
79
-    def __init__(self, transformers, **kwargs):
80
-        super(PrometheusCollector, self).__init__(transformers, **kwargs)
80
+    def __init__(self, **kwargs):
81
+        super(PrometheusCollector, self).__init__(**kwargs)
81 82
         url = CONF.collector_prometheus.prometheus_url
82 83
 
83 84
         user = CONF.collector_prometheus.prometheus_user
@@ -176,13 +177,12 @@ class PrometheusCollector(collector.BaseCollector):
176 177
                 item,
177 178
             )
178 179
 
179
-            item = self.t_cloudkitty.format_item(
180
+            formatted_resources.append(dataframe.DataPoint(
181
+                self.conf[metric_name]['unit'],
182
+                qty,
183
+                0,
180 184
                 groupby,
181 185
                 metadata,
182
-                self.conf[metric_name]['unit'],
183
-                qty=qty,
184
-            )
185
-
186
-            formatted_resources.append(item)
186
+            ))
187 187
 
188 188
         return formatted_resources

+ 1
- 3
cloudkitty/orchestrator.py View File

@@ -39,7 +39,6 @@ from cloudkitty import extension_manager
39 39
 from cloudkitty import messaging
40 40
 from cloudkitty import storage
41 41
 from cloudkitty import storage_state as state
42
-from cloudkitty import transformer
43 42
 from cloudkitty import tzutils
44 43
 from cloudkitty import utils as ck_utils
45 44
 
@@ -334,8 +333,7 @@ class Orchestrator(cotyledon.Service):
334 333
             invoke_on_load=True,
335 334
         ).driver
336 335
 
337
-        transformers = transformer.get_transformers()
338
-        self.collector = collector.get_collector(transformers)
336
+        self.collector = collector.get_collector()
339 337
         self.storage = storage.get_storage()
340 338
         self._state = state.StateManager()
341 339
 

+ 0
- 2
cloudkitty/tests/collectors/test_gnocchi.py View File

@@ -17,7 +17,6 @@
17 17
 from cloudkitty.collector import gnocchi
18 18
 from cloudkitty import tests
19 19
 from cloudkitty.tests import samples
20
-from cloudkitty import transformer
21 20
 
22 21
 
23 22
 class GnocchiCollectorTest(tests.TestCase):
@@ -29,7 +28,6 @@ class GnocchiCollectorTest(tests.TestCase):
29 28
             'gnocchi_auth_type', 'basic', 'collector_gnocchi')
30 29
 
31 30
         self.collector = gnocchi.GnocchiCollector(
32
-            transformer.get_transformers(),
33 31
             period=3600,
34 32
             conf=samples.DEFAULT_METRICS_CONF,
35 33
         )

+ 0
- 2
cloudkitty/tests/collectors/test_monasca.py View File

@@ -18,7 +18,6 @@ import mock
18 18
 
19 19
 from cloudkitty.collector import monasca as mon_collector
20 20
 from cloudkitty import tests
21
-from cloudkitty import transformer
22 21
 
23 22
 
24 23
 class MonascaCollectorTest(tests.TestCase):
@@ -50,7 +49,6 @@ class MonascaCollectorTest(tests.TestCase):
50 49
                 'MonascaCollector._get_monasca_endpoint',
51 50
                 return_value='http://noop'):
52 51
             self.collector = mon_collector.MonascaCollector(
53
-                transformer.get_transformers(),
54 52
                 period=3600,
55 53
                 conf=conf,
56 54
             )

+ 1
- 3
cloudkitty/tests/collectors/test_prometheus.py View File

@@ -24,7 +24,6 @@ from cloudkitty.common.prometheus_client import PrometheusResponseError
24 24
 from cloudkitty import dataframe
25 25
 from cloudkitty import tests
26 26
 from cloudkitty.tests import samples
27
-from cloudkitty import transformer
28 27
 
29 28
 
30 29
 class PrometheusCollectorTest(tests.TestCase):
@@ -53,8 +52,7 @@ class PrometheusCollectorTest(tests.TestCase):
53 52
                 }
54 53
             }
55 54
         }
56
-        transformers = transformer.get_transformers()
57
-        self.collector = prometheus.PrometheusCollector(transformers, **args)
55
+        self.collector = prometheus.PrometheusCollector(**args)
58 56
 
59 57
     def test_fetch_all_build_query(self):
60 58
         query = (

+ 0
- 54
cloudkitty/tests/transformers/__init__.py View File

@@ -1,54 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Copyright 2016 Objectif Libre
3
-#
4
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
-#    not use this file except in compliance with the License. You may obtain
6
-#    a copy of the License at
7
-#
8
-#         http://www.apache.org/licenses/LICENSE-2.0
9
-#
10
-#    Unless required by applicable law or agreed to in writing, software
11
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
-#    License for the specific language governing permissions and limitations
14
-#    under the License.
15
-#
16
-from cloudkitty.tests import samples
17
-from cloudkitty import transformer
18
-
19
-
20
-class Transformer(transformer.BaseTransformer):
21
-    compute_map = {
22
-        'name': ['name', 'display_name'],
23
-        'flavor': ['flavor', 'flavor.name', 'instance_type'],
24
-        'vcpus': ['vcpus'],
25
-        'memory': ['memory', 'memory_mb'],
26
-        'image_id': ['image_id', 'image.id', 'image_meta.base_image_ref'],
27
-        'availability_zone': [
28
-            'availability_zone',
29
-            'OS-EXT-AZ.availability_zone'],
30
-    }
31
-    volume_map = {
32
-        'volume_id': ['volume_id'],
33
-        'name': ['display_name'],
34
-        'availability_zone': ['availability_zone'],
35
-        'size': ['size'],
36
-    }
37
-    test_map = {'test': lambda x, y: 'ok'}
38
-
39
-    def _strip_network(self, res_metadata):
40
-        return {'test': 'ok'}
41
-
42
-
43
-class TransformerMeta(Transformer):
44
-    metadata_item = 'metadata'
45
-
46
-
47
-class EmptyClass(object):
48
-    pass
49
-
50
-
51
-class ClassWithAttr(object):
52
-    def __init__(self, items=samples.COMPUTE_METADATA):
53
-        for key, val in items.items():
54
-            setattr(self, key, val)

+ 0
- 68
cloudkitty/tests/transformers/test_base.py View File

@@ -1,68 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Copyright 2016 Objectif Libre
3
-#
4
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
-#    not use this file except in compliance with the License. You may obtain
6
-#    a copy of the License at
7
-#
8
-#         http://www.apache.org/licenses/LICENSE-2.0
9
-#
10
-#    Unless required by applicable law or agreed to in writing, software
11
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
-#    License for the specific language governing permissions and limitations
14
-#    under the License.
15
-#
16
-import copy
17
-
18
-from cloudkitty import tests
19
-from cloudkitty.tests import samples
20
-from cloudkitty.tests import transformers as t_transformers
21
-
22
-TRANS_METADATA = {
23
-    'availability_zone': 'nova',
24
-    'flavor': 'm1.nano',
25
-    'image_id': 'f5600101-8fa2-4864-899e-ebcb7ed6b568',
26
-    'memory': '64',
27
-    'name': 'prod1',
28
-    'vcpus': '1'}
29
-
30
-
31
-class TransformerBaseTest(tests.TestCase):
32
-    def test_strip_resource_on_dict(self):
33
-        metadata = copy.deepcopy(samples.COMPUTE_METADATA)
34
-        t_test = t_transformers.Transformer()
35
-        result = t_test.strip_resource_data('compute', metadata)
36
-        self.assertEqual(TRANS_METADATA, result)
37
-
38
-    def test_strip_resource_with_no_rules(self):
39
-        metadata = copy.deepcopy(samples.COMPUTE_METADATA)
40
-        t_test = t_transformers.Transformer()
41
-        result = t_test.strip_resource_data('unknown', metadata)
42
-        self.assertEqual(samples.COMPUTE_METADATA, result)
43
-
44
-    def test_strip_resource_with_func(self):
45
-        metadata = {'test': 'dummy'}
46
-        t_test = t_transformers.Transformer()
47
-        result = t_test.strip_resource_data('test', metadata)
48
-        self.assertEqual({'test': 'ok'}, result)
49
-
50
-    def test_strip_resource_with_stripping_function(self):
51
-        metadata = {}
52
-        t_test = t_transformers.Transformer()
53
-        result = t_test.strip_resource_data('network', metadata)
54
-        self.assertEqual({'test': 'ok'}, result)
55
-
56
-    def test_strip_resource_with_subitem(self):
57
-        test_obj = t_transformers.EmptyClass()
58
-        test_obj.metadata = copy.deepcopy(samples.COMPUTE_METADATA)
59
-        t_test = t_transformers.TransformerMeta()
60
-        result = t_test.strip_resource_data('compute', test_obj)
61
-        self.assertEqual(TRANS_METADATA, result)
62
-
63
-    def test_strip_resource_with_attributes(self):
64
-        test_obj = t_transformers.EmptyClass()
65
-        test_obj.metadata = t_transformers.ClassWithAttr()
66
-        t_test = t_transformers.TransformerMeta()
67
-        result = t_test.strip_resource_data('compute', test_obj)
68
-        self.assertEqual(TRANS_METADATA, result)

+ 0
- 69
cloudkitty/transformer/__init__.py View File

@@ -1,69 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Copyright 2014 Objectif Libre
3
-#
4
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
-#    not use this file except in compliance with the License. You may obtain
6
-#    a copy of the License at
7
-#
8
-#         http://www.apache.org/licenses/LICENSE-2.0
9
-#
10
-#    Unless required by applicable law or agreed to in writing, software
11
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
-#    License for the specific language governing permissions and limitations
14
-#    under the License.
15
-#
16
-import abc
17
-
18
-import six
19
-from stevedore import extension
20
-
21
-TRANSFORMERS_NAMESPACE = 'cloudkitty.transformers'
22
-
23
-
24
-def get_transformers():
25
-    transformers = {}
26
-    transformer_exts = extension.ExtensionManager(
27
-        TRANSFORMERS_NAMESPACE,
28
-        invoke_on_load=True)
29
-    for transformer in transformer_exts:
30
-        t_name = transformer.name
31
-        t_obj = transformer.obj
32
-        transformers[t_name] = t_obj
33
-    return transformers
34
-
35
-
36
-@six.add_metaclass(abc.ABCMeta)
37
-class BaseTransformer(object):
38
-    metadata_item = ''
39
-
40
-    def generic_strip(self, datatype, data):
41
-        metadata = getattr(data, self.metadata_item, data)
42
-        mappings = getattr(self, datatype + '_map', {})
43
-        result = {}
44
-        for key, transform in mappings.items():
45
-            if isinstance(transform, list):
46
-                for meta_key in transform:
47
-                    if key not in result or result[key] is None:
48
-                        try:
49
-                            data = getattr(metadata, meta_key)
50
-                        except AttributeError:
51
-                            data = metadata.get(meta_key)
52
-                        result[key] = data
53
-            else:
54
-                trans_data = transform(self, metadata)
55
-                if trans_data:
56
-                    result[key] = trans_data
57
-        return result
58
-
59
-    def strip_resource_data(self, res_type, res_data):
60
-        res_type = res_type.replace('.', '_')
61
-        strip_func = getattr(self, '_strip_' + res_type, None)
62
-        if strip_func:
63
-            return strip_func(res_data)
64
-        return self.generic_strip(res_type, res_data) or res_data
65
-
66
-    def get_metadata(self, res_type):
67
-        """Return list of metadata available for given resource type."""
68
-
69
-        return []

+ 0
- 43
cloudkitty/transformer/format.py View File

@@ -1,43 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Copyright 2014 Objectif Libre
3
-#
4
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
-#    not use this file except in compliance with the License. You may obtain
6
-#    a copy of the License at
7
-#
8
-#         http://www.apache.org/licenses/LICENSE-2.0
9
-#
10
-#    Unless required by applicable law or agreed to in writing, software
11
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
-#    License for the specific language governing permissions and limitations
14
-#    under the License.
15
-#
16
-
17
-from oslo_log import log
18
-
19
-from cloudkitty import dataframe
20
-from cloudkitty import transformer
21
-
22
-
23
-LOG = log.getLogger(__name__)
24
-
25
-
26
-class CloudKittyFormatTransformer(transformer.BaseTransformer):
27
-    def format_item(self, groupby, metadata, unit, qty=1.0):
28
-        # data = {}
29
-        # data['groupby'] = groupby
30
-        # data['metadata'] = metadata
31
-        # # For backward compatibility.
32
-        # data['desc'] = data['groupby'].copy()
33
-        # data['desc'].update(data['metadata'])
34
-        # data['vol'] = {'unit': unit, 'qty': qty}
35
-
36
-        return dataframe.DataPoint(unit, qty, 0, groupby, metadata)
37
-        # return data
38
-
39
-    def format_service(self, service, items):
40
-        data = {}
41
-        data[service] = items
42
-
43
-        return data

+ 6
- 5
doc/source/developer/collector.rst View File

@@ -61,8 +61,8 @@ following prototype:
61 61
 .. autoclass:: cloudkitty.collector.BaseCollector
62 62
    :members: fetch_all
63 63
 
64
-This method is supposed to return a list of objects formatted by
65
-``CloudKittyFormatTransformer``.
64
+This method is supposed to return a list of
65
+``cloudkitty.dataframe.DataPoint`` objects.
66 66
 
67 67
 Example code of a basic collector:
68 68
 
@@ -79,11 +79,12 @@ Example code of a basic collector:
79 79
             data = []
80 80
             for CONDITION:
81 81
                 # do stuff
82
-                data.append(self.t_cloudkitty.format_item(
82
+                data.append(dataframe.DataPoint(
83
+                    unit,
84
+                    qty, # int, float, decimal.Decimal or str
85
+                    0, # price
83 86
                     groupby, # dict
84 87
                     metadata, # dict
85
-                    unit, # str
86
-                    qty=qty, # int / float
87 88
                 ))
88 89
 
89 90
             return data

+ 5
- 0
releasenotes/notes/remove-transformers-8d9949ed3088b055.yaml View File

@@ -0,0 +1,5 @@
1
+---
2
+other:
3
+  - |
4
+    Since data frames are now represented as objects internally, transformers
5
+    are not used anymore and have been completely removed from the codebase.

+ 0
- 3
setup.cfg View File

@@ -57,9 +57,6 @@ cloudkitty.fetchers =
57 57
     gnocchi = cloudkitty.fetcher.gnocchi:GnocchiFetcher
58 58
     prometheus = cloudkitty.fetcher.prometheus:PrometheusFetcher
59 59
 
60
-cloudkitty.transformers =
61
-    CloudKittyFormatTransformer = cloudkitty.transformer.format:CloudKittyFormatTransformer
62
-
63 60
 cloudkitty.rating.processors =
64 61
     noop = cloudkitty.rating.noop:Noop
65 62
     hashmap = cloudkitty.rating.hash:HashMap

Loading…
Cancel
Save