Unify the timestamp of samples generated by polling agents

Many of the pollsters define the timestamp individually for each generated
sample, which should really be timestamping based on when the data was polled
and not when each sample is generated. We need to set the timestamp of the
polled data to the timestamp when the polling starts for unity.

Related-Bug: #1491509
Blueprint unify-timestamp-of-polled-data

Change-Id: If22980c9fdf81e1c76dcd4a9053daf88d7f89d18
This commit is contained in:
Wen Zhi Yu 2016-02-24 15:29:29 +08:00
parent dd0fe3004c
commit 2bc3d225ec
1 changed files with 140 additions and 0 deletions

View File

@ -0,0 +1,140 @@
..
This work is licensed under a Creative Commons Attribution 3.0 Unported
License.
http://creativecommons.org/licenses/by/3.0/legalcode
============================================================
Unify the timestamp of samples generated by polling agents
============================================================
https://blueprints.launchpad.net/ceilometer/+spec/unify-timestamp-of-polled-data
Problem description
===================
Many of the pollsters define the timestamp individually for each generated
sample, which should really be timestamping based on when the data was polled
and not when each sample is generated. We need to set the timestamp of the
polled data to the timestamp when the polling starts for unity.
This should save overhead of calculating timestamp each sample and also allow
for easier grouping of polled data.
Proposed change
===============
Modify ceilometer.agent.manager.PollingTask.poll_and_notify method to set the
timestamp of samples to the time when the data was polled::
# Get the timestamp when pollster starts to work
polling_timestamp = self._get_current_timestamp()
samples = pollster.obj.get_samples(
manager=self.manager,
cache=cache,
resources=polling_resources
)
for sample in samples:
# Unify the timestamp of polled samples
sample.set_timestamp(polling_timestamp)
Drop all the timestamp generations when we build samples via pollsters, like:
https://github.com/openstack/ceilometer/blob/6.0.0.0b2/ceilometer/image/glance.py#L113
Alternatives
------------
None
Data model impact
-----------------
None
REST API impact
---------------
None
Security impact
---------------
None
Pipeline impact
---------------
None
Other end user impact
---------------------
None
Performance/Scalability Impacts
-------------------------------
Save overhead of calculating timestamp each sample.
Other deployer impact
---------------------
None
Developer impact
----------------
None
Implementation
==============
Assignee(s)
-----------
Primary assignee:
<yuywz>
Work Items
----------
Update ceilometer.agent.manager.PollingTask.poll_and_notify method.
Drop all the timestamp generations when we build samples via pollsters.
Future lifecycle
================
None
Dependencies
============
None
Testing
=======
Add unit test to test:
The timestamp of samples generated during a polling cycle is unified.
Documentation Impact
====================
None
References
==========
Originally reported as a bug: https://bugs.launchpad.net/ceilometer/+bug/1491509
Blueprint: https://blueprints.launchpad.net/ceilometer/+spec/unify-timestamp-of-polled-data