Wrapping single metrics in a list on post

For efficiency we're using the Kafka clients send_messages function which takes
a variable number of messages to send and batches them so that they can be read
one at a time.  To do this we use the * operator to expand the list of metrics
as we pass them to the send_messages function.  If the input data is not a list
this doesn't work so even single metrics need to be bundled in a list.

Change-Id: I2f196b37db0db95a5163696f14258a865fa9a615
This commit is contained in:
Joe Keen 2015-06-19 17:04:13 -06:00
parent bb6ef0e57a
commit 08c200b6a8
1 changed files with 1 additions and 1 deletions

View File

@ -30,4 +30,4 @@ def transform(metrics, tenant_id, region):
return transformed_metrics
else:
transformed_metric['metric'] = metrics
return transformed_metric
return [json.dumps(transformed_metric)]