get_metric_statistics returning unordered results #1398

Open
duduklein opened this Issue Mar 18, 2013 · 0 comments

Projects

None yet

1 participant

@duduklein
Contributor

"get_metric_statistics" method from "CloudWatchConnection" is returning unordered results somehow.

Here is my call:
cw = CloudWatchConnection()
end = datetime.datetime(2013, 3, 18, 16, 49, 9, 514410)
start = datetime.datetime(2013, 3, 18, 15, 49, 9, 514410)
metric = 'CPUUtilization'
cw.get_metric_statistics(300, start, end, metric, 'AWS/EC2', 'Average',{'InstanceId':'i-123456'},unit='Percent')

Results:
[{u'Average': 29.703999999999997,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 44),
u'Unit': u'Percent'},
{u'Average': 53.8,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 19),
u'Unit': u'Percent'},
{u'Average': 31.838,
u'Timestamp': datetime.datetime(2013, 3, 18, 15, 49),
u'Unit': u'Percent'},
{u'Average': 30.910000000000004,
u'Timestamp': datetime.datetime(2013, 3, 18, 15, 59),
u'Unit': u'Percent'},
{u'Average': 25.946000000000005,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 39),
u'Unit': u'Percent'},
{u'Average': 26.139999999999997,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 14),
u'Unit': u'Percent'},
{u'Average': 50.154,
u'Timestamp': datetime.datetime(2013, 3, 18, 15, 54),
u'Unit': u'Percent'},
{u'Average': 21.315999999999995,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 34),
u'Unit': u'Percent'},
{u'Average': 21.134000000000004,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 29),
u'Unit': u'Percent'},
{u'Average': 23.382,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 4),
u'Unit': u'Percent'},
{u'Average': 26.401999999999997,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 9),
u'Unit': u'Percent'},
{u'Average': 50.44333333333333,
u'Timestamp': datetime.datetime(2013, 3, 18, 16, 24),
u'Unit': u'Percent'}]

Here is the same call with the command line API:
mon-get-stats CPUUtilization --start-time 2013-03-18T15:49:09 --end-time 2013-03-18T16:49:06 --period 300 --statistics "Average" --namespace "AWS/EC2" --dimensions "InstanceId=i-123456"

Results:
2013-03-18 15:49:00 31.838 Percent
2013-03-18 15:54:00 50.154 Percent
2013-03-18 15:59:00 30.910000000000004 Percent
2013-03-18 16:04:00 23.382 Percent
2013-03-18 16:09:00 26.401999999999997 Percent
2013-03-18 16:14:00 26.139999999999997 Percent
2013-03-18 16:19:00 53.8 Percent
2013-03-18 16:24:00 50.44333333333333 Percent
2013-03-18 16:29:00 21.134000000000004 Percent
2013-03-18 16:34:00 21.315999999999995 Percent
2013-03-18 16:39:00 25.946000000000005 Percent
2013-03-18 16:44:00 29.703999999999997 Percent

As can be seen, the results are numerically the same, but the order is kept using the CLI version, but not using boto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment