"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cloudkitty/collector/prometheus.py" between
cloudkitty-12.1.0.tar.gz and cloudkitty-13.0.0.tar.gz

About: OpenStack CloudKitty provides Rating-as-a-Service for OpenStack.
The "Victoria" series (latest release).

prometheus.py  (cloudkitty-12.1.0):prometheus.py  (cloudkitty-13.0.0)
skipping to change at line 131 skipping to change at line 131
return output return output
def _format_data(self, metric_name, scope_key, scope_id, start, end, data): def _format_data(self, metric_name, scope_key, scope_id, start, end, data):
"""Formats Prometheus data format to Cloudkitty data format. """Formats Prometheus data format to Cloudkitty data format.
Returns metadata, groupby, qty Returns metadata, groupby, qty
""" """
metadata = {} metadata = {}
for meta in self.conf[metric_name]['metadata']: for meta in self.conf[metric_name]['metadata']:
metadata[meta] = data['metric'][meta] metadata[meta] = data['metric'].get(meta, '')
groupby = {scope_key: scope_id} groupby = {scope_key: scope_id}
for meta in self.conf[metric_name]['groupby']: for meta in self.conf[metric_name]['groupby']:
groupby[meta] = data['metric'].get(meta, '') groupby[meta] = data['metric'].get(meta, '')
with localcontext() as ctx: with localcontext() as ctx:
ctx.prec = 9 ctx.prec = 9
ctx.rounding = ROUND_HALF_UP ctx.rounding = ROUND_HALF_UP
qty = ck_utils.convert_unit( qty = ck_utils.convert_unit(
+Decimal(data['value'][1]), +Decimal(data['value'][1]),
self.conf[metric_name]['factor'], self.conf[metric_name]['factor'],
self.conf[metric_name]['offset'], self.conf[metric_name]['offset'],
) )
qty = ck_utils.mutate(qty, self.conf[metric_name]['mutate'])
return metadata, groupby, qty return metadata, groupby, qty
def fetch_all(self, metric_name, start, end, scope_id, q_filter=None): def fetch_all(self, metric_name, start, end, scope_id, q_filter=None):
"""Returns metrics to be valorized.""" """Returns metrics to be valorized."""
scope_key = CONF.collect.scope_key scope_key = CONF.collect.scope_key
method = self.conf[metric_name]['extra_args']['aggregation_method'] method = self.conf[metric_name]['extra_args']['aggregation_method']
query_function = self.conf[metric_name]['extra_args'].get( query_function = self.conf[metric_name]['extra_args'].get(
'query_function') 'query_function')
range_function = self.conf[metric_name]['extra_args'].get( range_function = self.conf[metric_name]['extra_args'].get(
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)