sample.Sample doesn't have string format method

Bug #1386187 reported by ZhiQiang Fan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Low
ZhiQiang Fan

Bug Description

which will cause only shows in logs:
Transform sample <ceilometer.sample.Sample object at 0x7f534ef378d0> from 0 transformer

we can see this in local environment or kibana, see: http://logstash.openstack.org/#eyJzZWFyY2giOiJwcm9qZWN0Olwib3BlbnN0YWNrL2NlaWxvbWV0ZXJcIiBBTkQgbWVzc2FnZTpcImNlaWxvbWV0ZXIuc2FtcGxlLlNhbXBsZVwiIiwiZmllbGRzIjpbXSwib2Zmc2V0IjowLCJ0aW1lZnJhbWUiOiI2MDQ4MDAiLCJncmFwaG1vZGUiOiJjb3VudCIsInRpbWUiOnsidXNlcl9pbnRlcnZhbCI6MH0sInN0YW1wIjoxNDE0NDE0MzkzNDE0LCJtb2RlIjoiIiwiYW5hbHl6ZV9maWVsZCI6IiJ9

in source code, where print logs about sample, are

* https://github.com/openstack/ceilometer/blob/master/ceilometer/pipeline.py#L272
* https://github.com/openstack/ceilometer/blob/master/ceilometer/pipeline.py#L293
* https://github.com/openstack/ceilometer/blob/master/ceilometer/transformer/conversions.py#L116
* https://github.com/openstack/ceilometer/blob/master/ceilometer/transformer/conversions.py#L137
* https://github.com/openstack/ceilometer/blob/master/ceilometer/transformer/conversions.py#L139

sample.Sample already has a method as_dict() to get formated string, but it is not nature for log, and developer must knew this detail and check carefully when they print log, I think we should better to provide a __repr__ method, which just do same thing as as_dict(), which will be much more convinent

ZhiQiang Fan (aji-zqfan)
Changed in ceilometer:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
gordon chung (chungg)
Changed in ceilometer:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

Fix proposed to branch: master
Review: https://review.openstack.org/131324

Changed in ceilometer:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/131324
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=21f926586b92e320001a6c42ed75ad283162d9d0
Submitter: Jenkins
Branch: master

commit 21f926586b92e320001a6c42ed75ad283162d9d0
Author: ZhiQiang Fan <email address hidden>
Date: Tue Oct 28 00:09:42 2014 +0800

    Add __repr__ method for sample.Sample

    sample.Sample has no string format method, which will cause useless
    message when print log.

    Change-Id: I8b9863a4ac6ee3373e18d36681fbfc4c89732111
    Closes-Bug: #1386187

Changed in ceilometer:
status: In Progress → Fix Committed
Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: none → kilo-1
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.