disk_gb trait field defined as int but displayed as string with None value

Bug #1450042 reported by Balazs Gibizer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Medium
gordon chung

Bug Description

Using fresh ceilometer in a fresh devstack I see that /etc/ceilometer/event_definitions.yaml contians the disk_gb field as an integer

    disk_gb:
      type: int
      fields: payload.disk_gb

Then when I check the output of the ceilometer event-list the same field displayed as string with a None value

| d42b61f3-31fd-4771-a610-0ce3378012b6 | compute.instance.exists | 2015-04-29T14:00:03.574346 | +------------------------+----------+------------------------------------------+ |
| | | | | name | type | value | |
| | | | +------------------------+----------+------------------------------------------+ |
| | | | | audit_period_beginning | datetime | 2015-04-29T13:00:00 | |
| | | | | audit_period_ending | datetime | 2015-04-29T14:00:00 | |
| | | | | disk_gb | string | None | |
| | | | | ephemeral_gb | string | None | |
| | | | | host | string | Devstack | |
| | | | | instance_id | string | 9a64b9e2-b6b2-4afe-b89a-10e986b3c537 | |
| | | | | instance_type | string | m1.nano | |
| | | | | instance_type_id | integer | 6 | |
| | | | | launched_at | datetime | 2015-04-29T11:48:19 | |
| | | | | memory_mb | integer | 64 | |
| | | | | request_id | string | req-78f434aa-cea0-4984-9bd5-5a8103b4fee5 | |
| | | | | root_gb | string | None | |
| | | | | service | string | compute | |
| | | | | state | string | active | |
| | | | | tenant_id | string | 7e6bce9927f142b28c61799955722c8c | |
| | | | | user_id | string | f9a4cb0fe04f49af95bb0c710c0773a4 | |
| | | | | vcpus | integer | 1 | |
| | | | +------------------------+----------+------------------------------------------+ |

gordon chung (chungg)
Changed in ceilometer:
status: New → Triaged
importance: Undecided → Critical
importance: Critical → Medium
Changed in ceilometer:
assignee: nobody → Rohit Jaiswal (rohit-jaiswal-3)
Revision history for this message
gordon chung (chungg) wrote :

@Rohit, you have a solution? if not, i can send my patch.

Revision history for this message
gordon chung (chungg) wrote :
Revision history for this message
gordon chung (chungg) wrote :

def test_trait_type_enforced_on_none(self):
        new_events = [event_models.Event(
            "id_testid", "MessageIDTest", self.start,
            [event_models.Trait('text', event_models.Trait.TEXT_TYPE, ''),
             event_models.Trait('int', event_models.Trait.INT_TYPE, 0),
             event_models.Trait('float', event_models.Trait.FLOAT_TYPE, 0.0)],
            {})]
        self.event_conn.record_events(new_events)
        event_filter = storage.EventFilter(message_id="id_testid")
        events = [event for event in self.event_conn.get_events(event_filter)]
        options = [event_models.Trait.TEXT_TYPE, event_models.Trait.INT_TYPE,
                   event_models.Trait.FLOAT_TYPE]
        for trait in events[0].traits:
            options.remove(trait.dtype)

here's a test.

Revision history for this message
Rohit Jaiswal (rohit-jaiswal-3) wrote :

@gordc: Thanks, I didnt realize you had a fix, unassigning.

Changed in ceilometer:
assignee: Rohit Jaiswal (rohit-jaiswal-3) → nobody
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/178816

Changed in ceilometer:
assignee: nobody → gordon chung (chungg)
status: Triaged → In Progress
Revision history for this message
gordon chung (chungg) wrote :

tagging kilo-backport-potential as it affects a 'relatively' small set of cases.

ie.
- only on sql
- only on 0 or 0.0 values

tags: added: kilo-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/178816
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=229f9f98b73b73918cd6f768520fdbce7121444f
Submitter: Jenkins
Branch: master

commit 229f9f98b73b73918cd6f768520fdbce7121444f
Author: gordon chung <email address hidden>
Date: Wed Apr 29 15:25:12 2015 -0400

    empty non-string values are returned as string traits

    when an integer or float trait are 0 or 0.0, sql backend incorrect
    returns them as string traits.

    Change-Id: I70b311e24bfab264bc2623a5089cd7971041896e
    Closes-Bug: #1450042

Changed in ceilometer:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: liberty-1 → 5.0.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.