<br><br><div class="gmail_quote">On Fri, Nov 16, 2012 at 8:57 AM, Julien Danjou <span dir="ltr"><<a href="mailto:julien@danjou.info" target="_blank">julien@danjou.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I was working on fixing a bug in the API, and wrote a test that<br>
unexpectedly failed.<br>
<br>
Digging, I've discovered that it's currently a problem on how the<br>
MongoDB storage handles its `resource' collection: you can't have 2<br>
resource with the same id even if they came from 2 different sources.<br>
Meaning that if you record:<br>
<br>
  Counter(source='abc', resource_id='foobar')<br>
  Counter(source='def', resource_id='foobar')<br>
<br>
You'll end up with the 'source' field being overwritte because the<br>
resource collection use resource_id as its MongoDB _id field.<br>
<br>
So in the end, the request '/sources/abc/resources/foobar' returns<br>
nothing.<br>
<br>
This seems like a bug to me, because I easily imagine external systems<br>
with different source values having resource-id that can collide,<br>
because they're not UUID or the like.<br>
<br>
Doug, what's your opinion this, and how to fix it?<br></blockquote><div><br></div><div>I'm not sure we can tell, from the inside of ceilometer, what a unique identifier for a resource described by a given meter event should be. I think the intent was that the sender would do whatever was necessary to ensure it was unique. If the sender is concerned about collisions, it could prefix the resource id with some constant identifying the sender.</div>
<div><br></div><div>Doug</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Julien Danjou<br>
# Free Software hacker & freelance<br>
# <a href="http://julien.danjou.info" target="_blank">http://julien.danjou.info</a><br>
</font></span></blockquote></div><br>