Change timestamp management for resources

When saving an event, update the timestamp on a resource to the
event timestamp instead of the current timestamp on the
collector host.

Change-Id: Ice378cb5be0820d8b817b7c4f635b8a5a8eef3b5
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
Doug Hellmann 2012-08-28 16:32:51 -04:00
parent 5b153d5a8c
commit 029ee37337

View File

@ -231,14 +231,15 @@ class Connection(base.Connection):
)
# Record the updated resource metadata
timestamp = datetime.datetime.utcnow()
received_timestamp = datetime.datetime.utcnow()
self.db.resource.update(
{'_id': data['resource_id']},
{'$set': {'project_id': data['project_id'],
'user_id': data['user_id'],
# Current metadata being used and when it was
# last updated.
'timestamp': timestamp,
'timestamp': data['timestamp'],
'received_timestamp': received_timestamp,
'metadata': data['resource_metadata'],
'source': data['source'],
},