统一由轮询代理生成的样本的时间戳¶
https://blueprints.launchpad.net/ceilometer/+spec/unify-timestamp-of-polled-data
问题描述¶
许多轮询器为每个生成的样本单独定义时间戳,而实际上应该基于数据轮询的时间进行时间戳记录,而不是每个样本生成的时间。我们需要将轮询数据的的时间戳设置为轮询开始的时间,以实现统一。
这应该可以节省每次样本计算时间戳的开销,并允许更轻松地对轮询数据进行分组。
提议的变更¶
修改 ceilometer.agent.manager.PollingTask.poll_and_notify 方法,将样本的时间戳设置为轮询数据的时间
# 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)
删除通过轮询器构建样本时生成的所有时间戳,例如: https://github.com/openstack/ceilometer/blob/6.0.0.0b2/ceilometer/image/glance.py#L113
替代方案¶
无
数据模型影响¶
无
REST API 影响¶
无
安全影响¶
无
Pipeline 影响¶
无
其他最终用户影响¶
无
性能/可扩展性影响¶
节省每次样本计算时间戳的开销。
其他部署影响¶
无
开发者影响¶
无
实现¶
负责人¶
- 主要负责人
<yuywz>
工作项¶
更新 ceilometer.agent.manager.PollingTask.poll_and_notify 方法。
删除通过轮询器构建样本时生成的所有时间戳。
未来生命周期¶
无
依赖项¶
无
测试¶
添加单元测试以测试:在轮询周期内生成的样本的时间戳是统一的。
文档影响¶
无
参考资料¶
最初报告为错误: https://bugs.launchpad.net/ceilometer/+bug/1491509 蓝图: https://blueprints.launchpad.net/ceilometer/+spec/unify-timestamp-of-polled-data