diff options
author | liusheng <liusheng@huawei.com> | 2015-10-10 22:04:57 +0800 |
---|---|---|
committer | liusheng <liusheng2048@gmail.com> | 2015-10-20 01:39:20 +0000 |
commit | 2c1227e09d7cedd9f10b21d0c8f18b2ebd03432f (patch) | |
tree | b5506c0145fa00a245c0a74d366014da767a8747 /tools/send_test_data.py | |
parent | 61dc67d3dbc020f4c0bee2a41e18dc312efaccec (diff) | |
download | ceilometer-2c1227e09d7cedd9f10b21d0c8f18b2ebd03432f.tar.gz |
Correct the timestamp type when make test samples data
When recording samples to database, the timestamp should be
datetime.datetime type, but in make_test_data.py, the timestamp
will be transformed to iso format with unicode type.
Change-Id: Iffb09a293684fb8eab768c7370e8967349032ae5
Closes-Bug: #1504539
Diffstat (limited to 'tools/send_test_data.py')
-rwxr-xr-x | tools/send_test_data.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/send_test_data.py b/tools/send_test_data.py index fb7dc0fb..0344d4da 100755 --- a/tools/send_test_data.py +++ b/tools/send_test_data.py @@ -81,6 +81,10 @@ def generate_data(send_batch, make_data_args, samples_count, resource = resources_list[random.randint(0, len(resources_list) - 1)] resource_samples[resource] += 1 sample['resource_id'] = resource + # need to change the timestamp from datetime.datetime type to iso + # format (unicode type), because collector will change iso format + # timestamp to datetime.datetime type before recording to db. + sample['timestamp'] = sample['timestamp'].isoformat() # need to recalculate signature because of the resource_id change sig = utils.compute_signature(sample, cfg.CONF.publisher.telemetry_secret) |