<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Hi, folks.<br><br></div>I was interested in the problem with storing of samples, that contain complex resource_metadata, in MongoDB database [1].<br>

<br></div>If data is a dict that has a  key(s) with dots (i.e. <tt class=""><span class="">.</span></tt>), dollar signs
(i.e. <tt class=""><span class="">$</span></tt>), or null characters,<br></div>it wouldn't be stored. It is happened because these characters are restricted to use in fields name in MongoDB  [2], but so far there is no any verification of the metadata in ceilometers mongodb driver, as a result we will lose data.<br>

<br></div>Solution of this problem seemed to be rather simple, before storing data we check keys in resourse_metadata, if it is a dict, and "quote" keys with restricted characters in a similar way, as it was done in a change request of redesign separators in columns in HBase [2]. After that store metering data.<br>

<br></div>But other unexpected difficulties appear on the step of getting data. To get stored data we constructs a meta query, and structure of that query was chosen identical to initial query in MongoDB. So dots is used as a separator for three nods of stored data.<br>

<br></div>Ex. If it is needed to check value in field "Foo"<br><br></div>{metadata: <br>                    { Zoo:  <br></div>                               {Foo: ''value"}}}<br><br></div>query would be: "metadata.Zoo.Foo"<br>

<br></div>We don't know how deep is dict in metadata, so it is impossible to propose any correct parsing of query, to "quote" field names contain dots.<br><br></div>I see two way for improvements. First is rather complex and based of redesign structure of the metadata query in ceilometer. Don't know if it is ever possible.<br>

<br></div>And second is based on removing from the samples "bad" resource_metadata. In this case we also lose metadata,  but save other metering data. Of course queries for not saved metadata will return nothing, so it is not complete solution, but some kind of the hook.<br>

<br></div>What do you think about that?<br></div>Any thoughts and propositions are kindly welcome.<br><div><div><div><div><div><div><div><div><div><div><br>[1] <a href="https://bugs.launchpad.net/mos/+bug/1360240">https://bugs.launchpad.net/mos/+bug/1360240</a><br>

[2] <a href="http://docs.mongodb.org/manual/reference/limits/">http://docs.mongodb.org/manual/reference/limits/</a><br>[3] <a href="https://review.openstack.org/#/c/106376/">https://review.openstack.org/#/c/106376/</a><br>

<div> <br><div><div><div><div><div><div dir="ltr">-- Igor Degtiarov<br></div></div>
</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>