Comment 7 for bug 1246264

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

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

commit f379b96dd2a301d1cfa70562454ec957d8341125
Author: Igor Degtiarov <email address hidden>
Date: Mon Dec 1 15:51:25 2014 +0200

    [MongoDB] Fix bug with 'bad' chars in metadatas keys

    MongoDB has two restrictions on fields names, they cannot contain '.' and
    start with '$'. In resource_metadata field we can get any data, so it could
    be dict with any keys, and if some key contain i.e. dots sample with this
    metadata wouldn't be stored in MongoDB.

    To protect samples from missing this patch propose to check metadata
    for occurrence of dots and '$' in keys if metadata is dict, and to transform
    dict with dots before storing it in MongoDB. Transformation means that
    we make dict more nested and new node appears where there is dot in dict
    key.

    It means that if we get metadata as a dict {'a.b.c': v} before storing in
    MongoDB it would be transform in {'a': {'b': {'c': v}}}.

    Closes-Bug: 1246264
    Change-Id: I279ae67cd24d4dadd7d7e58007e7c5c297d91772