why &quot;isParentOf&quot; is more suitable than &quot;contains&quot; in vertx as Thomas said? <br><br>If it is &quot;contains&quot;, it also makes sense to me since if &quot;MyApp&quot; is gone, the feeds it contains should disappear as well. <br><br>Austin<br><div class="gmail_quote"><div dir="ltr">Lukas Krejci &lt;<a href="mailto:lkrejci@redhat.com">lkrejci@redhat.com</a>&gt;於 2016年6月29日 週三,21:20寫道:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Btw. I&#39;ve slightly updated the inventory organization description on the<br>
hawkular site (<a href="http://www.hawkular.org/docs/components/inventory/index.html#inventory-organization" rel="noreferrer" target="_blank">http://www.hawkular.org/docs/components/inventory/<br>
index.html#inventory-organization</a>). I hope it explains the structure and<br>
intent of the entities in inventory in a slightly more comprehensible manner.<br>
<br>
My answers are inline below...<br>
<br>
On středa 29. června 2016 14:39:27 CEST Thomas Segismont wrote:<br>
&gt; Thank you very much for the thorough reply Lukas. A few<br>
&gt; questions/comments inline.<br>
&gt;<br>
&gt; Le 23/06/2016 à 15:59, Lukas Krejci a écrit :<br>
&gt; &gt; On Thursday, June 23, 2016 10:27:12 AM Thomas Segismont wrote:<br>
&gt; &gt;&gt; Hey Lukas,<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Thank you for pointing us in the sync endpoint. Austin will look into<br>
&gt; &gt;&gt; this and will certainly come back with more questions.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; With respect to the user creating resources question, the difference<br>
&gt; &gt;&gt; between Vert.x and Wildfly is that the user creates resources<br>
&gt; &gt;&gt; grammatically. So in version 1 of the application, there might be two<br>
&gt; &gt;&gt; HTTP servers as well as 7 event bus handlers, but only 1 http server in<br>
&gt; &gt;&gt; version 2. And a named worker pool in version 3.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; In the end, I believe it doesn&#39;t matter if it&#39;s container which creates<br>
&gt; &gt;&gt; resources or if it&#39;s the user himself. Does it?<br>
&gt; &gt;<br>
&gt; &gt; It does not really (inventory has just a single API, so it does not really<br>
&gt; &gt; know who is talking to it - if a feed or if a user) - but resources inside<br>
&gt; &gt; and outside feeds have slightly different semantics.<br>
&gt; &gt;<br>
&gt; &gt; Right now the logic is this:<br>
&gt; &gt;<br>
&gt; &gt; Feeds are &quot;agents&quot; that don&#39;t care about anything else but their own<br>
&gt; &gt; little<br>
&gt; &gt; &quot;world&quot;. That&#39;s why they can create their own resource types, metric types<br>
&gt; &gt; and they also declare resources and metrics of those types. Feed does not<br>
&gt; &gt; need to look &quot;outside&quot; of its own data and is in full charge of it.<br>
&gt;<br>
&gt; Does that mean that creating a feed is the only way to create<br>
&gt; resource/metric types?<br>
<br>
No, you can also create resource types and metric types directly under the<br>
tenant.<br>
<br>
&gt; I suppose the benefit of creating resource types is that then you can<br>
&gt; search for different resources of the same type easily.<br>
&gt;<br>
&gt; And if feeds create resource types, how do you know that resource types<br>
&gt; created by the Hawkular Agent feed running on server A are the same as<br>
&gt; those created by another agent running on server B?<br>
&gt;<br>
<br>
Inventory automatically computes &quot;identity hashes&quot; of resource types and<br>
metric types - if 2 resource types in 2 feeds have the same ID and exactly the<br>
same configuration definitions, they are considered identical. If you know 1<br>
resource type, you can find all the identical ones using the following REST<br>
API (since 0.17.0.Final, the format of the URLs is thoroughly explained here:<br>
<a href="http://www.hawkular.org/docs/rest/rest-inventory.html#_api_endpoints" rel="noreferrer" target="_blank">http://www.hawkular.org/docs/rest/rest-inventory.html#_api_endpoints</a>):<br>
<br>
/hawkular/inventory/traversal/f;feedId/rt;resourceTypeId/identical<br>
<br>
If for example some resource types should be known up-front and &quot;shared&quot;<br>
across all feeds, some kind of &quot;gluecode&quot; could create &quot;global&quot; resource types<br>
under the tenant, that would have the same id and structure as the types that<br>
the feeds declare. If then you want to for example find all resources of given<br>
type, you can:<br>
<br>
/hawkular/inventory/traversal/rt;myType/identical/rl;defines/type=resource<br>
<br>
I.e. for all types identical to the global one, find all resources defined by<br>
those types.<br>
<br>
&gt; &gt; Hence the /sync endpoint applies to a feed nicely - since it is in charge,<br>
&gt; &gt; it merely declares what is the view it has currently of the &quot;world&quot; it<br>
&gt; &gt; sees and inventory will make sure it has the same picture - under that<br>
&gt; &gt; feed.<br>
&gt; &gt;<br>
&gt; &gt; Now if you have an application that spans multiple vms/machines and is<br>
&gt; &gt; composed of multiple processes, there is no such clear distinction of<br>
&gt; &gt; &quot;ownership&quot;.<br>
&gt;<br>
&gt; Good point, Vert.x applications are often distributed and communicating<br>
&gt; over the EventBus.<br>
&gt;<br>
&gt; &gt; While indeed a &quot;real&quot; user can just act like a feed, the envisioned<br>
&gt; &gt; workflow is that the user operates directly in environments and at the<br>
&gt; &gt; top level. I.e. a user assigns feeds to environments (i.e. this feed<br>
&gt; &gt; reports on my server in staging environment, etc) and the user creates<br>
&gt; &gt; &quot;logical&quot; resources in the environment (i.e. &quot;My App&quot; resource in staging<br>
&gt; &gt; env is composed of a load balancer managed by this feed, mongodb managed<br>
&gt; &gt; by another feed there and clustered wflys there, there and there).<br>
&gt; &gt;<br>
&gt; &gt; To model this, inventory supports 2 kinds of tree hierarchies - 1 created<br>
&gt; &gt; using the &quot;contains&quot; relationship, which expresses existential ownership -<br>
&gt; &gt; i.e. a feed contains its resources and if a feed disappears, so do the<br>
&gt; &gt; resources, because no one else can report on them. The entities bound by<br>
&gt; &gt; the<br>
&gt; How does a feed &quot;disappear&quot;? That would be by deleting it through the<br>
&gt; REST API, correct? Something the ManageIQ provider would do through the<br>
&gt; Ruby client?<br>
&gt;<br>
<br>
yes<br>
<br>
&gt; &gt; contains relationship form a tree - no loops or diamonds in it (this is<br>
&gt; &gt; enforced by inventory). But there can also be a hierarchy created using an<br>
&gt; &gt; &quot;isParentOf&quot; relationship (which represents &quot;logical&quot; ownership).<br>
&gt; &gt; Resources<br>
&gt; &gt; bound by &quot;isParentOf&quot; can form an acyclic graph - i.e. 1 resource can have<br>
&gt; &gt; multiple parents as well as many children (isParentOf is applicable only<br>
&gt; &gt; to<br>
&gt; &gt; resources, not other types of entities).<br>
&gt; &gt;<br>
&gt; &gt; The hierarchies formed by &quot;contains&quot; and &quot;isParentOf&quot; are independent. So<br>
&gt; &gt; you can create a resource &quot;My App&quot; in the staging environment and declare<br>
&gt; &gt; it a parent (using &quot;isParentOf&quot;) of the resources declared by feeds that<br>
&gt; &gt; manage the machines where the constituent servers live.<br>
&gt;<br>
&gt; Interesting, that may be the way to model a Vert.x app deployed on two<br>
&gt; machines. Each process would have its own feed reporting discovered<br>
&gt; resources (http servers, event bus handlers, ... etc), and a logical app<br>
&gt; resource as parent.<br>
&gt;<br>
<br>
Exactly.<br>
<br>
&gt; &gt; That is the envisaged workflow for &quot;apps&quot;. Now the downside to that is<br>
&gt; &gt; that<br>
&gt; &gt; (currently) there is no &quot;sync&quot; for that. The reason is that the<br>
&gt; &gt; application<br>
&gt; &gt; really is a logical concept and the underlying servers can be repurposed<br>
&gt; &gt; to<br>
&gt; &gt; serve different applications (so if app stops using it, it shouldn&#39;t<br>
&gt; &gt; really<br>
&gt; &gt; disappear from inventory, as is the case with /sync - because if a feed<br>
&gt; &gt; doesn&#39;t &quot;see&quot; a resource, then it really is just gone, because the feed is<br>
&gt; &gt; solely responsible for reporting on it).<br>
&gt;<br>
&gt; What happens to the resources exactly? Are they marked as gone or simply<br>
&gt; deleted?<br>
<br>
Right now they are deleted. That is of course not optimal and versioning is in<br>
the pipeline right after the port of inventory to Tinkerpop3. Basically all<br>
the entities and relationships will get &quot;from&quot; and &quot;to&quot; timestamps.<br>
Implicitly, you&#39;d look at the &quot;present&quot;, but you&#39;d be able to look at how<br>
things looked in the past by specifying a different &quot;now&quot; in your query.<br>
<br>
&gt; Do you know how dependent services are updated? For example, when a JMS<br>
&gt; queue is gone, are alert definitions on queue depth removed as well? How<br>
&gt; does that happen?<br>
&gt;<br>
<br>
Inventory sends events on the bus about every C/U/D of every entity or<br>
relationship, so other components can react on that.<br>
<br>
&gt; &gt; We can think about how to somehow help clients with &quot;App sync&quot; but I&#39;m not<br>
&gt; &gt; sure if having a feed for vertx is the right thing to do. On the other<br>
&gt; &gt; hand I very well may not be seeing some obvious problems of the above or<br>
&gt; &gt; parallels that make the 2 approaches really the same because the above<br>
&gt; &gt; model is just ingrained in my brain after so many hours thinking about it<br>
&gt; &gt; ;)<br>
&gt; &gt;<br>
&gt; &gt;&gt; As for the feed question, the Vert.x feed will be the Metrics SPI<br>
&gt; &gt;&gt; implementation (vertx-hawkular-metrics project). Again I guess it&#39;s not<br>
&gt; &gt;&gt; much different than the Hawkular Agent.<br>
&gt; &gt;<br>
&gt; &gt; A feed would only be appropriate if vertx app never reported on something<br>
&gt; &gt; that would also be reported by other agents. I.e. if a part of a vertx<br>
&gt; &gt; application is also reported on by a wfly agent, because that part is<br>
&gt; &gt; running in a wfly server managed by us, then that will not work - 1<br>
&gt; &gt; resource cannot be &quot;contained&quot; in 2 different feeds (not just API wise,<br>
&gt; &gt; but logically, too).<br>
&gt; I&#39;m not too worried about this use case. First the vast majority of<br>
&gt; Vert.x applications I know about are not embedded. Secondly the Vert.x<br>
&gt; feed would not report resources already reported by the Hawkular Agent.<br>
&gt;<br>
&gt; &gt;&gt; Maybe the wording around user creating resources was confusing? Did you<br>
&gt; &gt;&gt; thought he would do so from application code? In this case, the answer<br>
&gt; &gt;&gt; is no.<br>
&gt; &gt;<br>
&gt; &gt; Yeah, we should probably get together and discuss what your plans are to<br>
&gt; &gt; get on the same page with everything.<br>
&gt;<br>
&gt; I believe that presenting to you (and to whoever is interested) the<br>
&gt; conclusions of investigations would be beneficial indeed.<br>
&gt;<br>
<br>
+1<br>
<br>
&gt; &gt;&gt; Regards,<br>
&gt; &gt;&gt; Thomas<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Le 23/06/2016 à 10:01, Austin Kuo a écrit :<br>
&gt; &gt;&gt;&gt; Yes, I’m gonna build the inventory for vertx applications.<br>
&gt; &gt;&gt;&gt; So I have to create a feed for it.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; Thanks!<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; On Tue, Jun 21, 2016 at 7:55 PM Lukas Krejci &lt;<a href="mailto:lkrejci@redhat.com" target="_blank">lkrejci@redhat.com</a><br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; &lt;mailto:<a href="mailto:lkrejci@redhat.com" target="_blank">lkrejci@redhat.com</a>&gt;&gt; wrote:<br>
&gt; &gt;&gt;&gt;     Hi Austin,<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     Inventory offers a /hawkular/inventory/sync endpoint that is used to<br>
&gt; &gt;&gt;&gt;     synchronize the &quot;world view&quot; of feeds (feed being something that<br>
&gt; &gt;&gt;&gt;     pushes data<br>
&gt; &gt;&gt;&gt;     into inventory).<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     You said though that a &quot;user creates&quot; the resources, so I am not<br>
&gt; &gt;&gt;&gt;     sure if /sync<br>
&gt; &gt;&gt;&gt;     would be applicable to your scenario. Would you please elaborate<br>
&gt; &gt;&gt;&gt;     more on where<br>
&gt; &gt;&gt;&gt;     in the inventory hierarchy you create your resources and how? I.e.<br>
&gt; &gt;&gt;&gt;     are you<br>
&gt; &gt;&gt;&gt;     using some sort of feed akin to Hawkular&#39;s Wildfly Agent or are you<br>
&gt; &gt;&gt;&gt;     just<br>
&gt; &gt;&gt;&gt;     creating your resources &quot;manually&quot; under environments?<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     On Tuesday, June 21, 2016 02:20:33 AM Austin Kuo wrote:<br>
&gt; &gt;&gt;&gt;     &gt; Hi all,<br>
&gt; &gt;&gt;&gt;     &gt;<br>
&gt; &gt;&gt;&gt;     &gt; I’m currently investigating how to sync with inventory server.<br>
&gt; &gt;&gt;&gt;     &gt; Here’s the example scenario:<br>
&gt; &gt;&gt;&gt;     &gt; Consider the following problem. A user creates version 1 of the<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     app with<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     &gt; two http servers, one listening on port 8080, the other on port<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     8181. In<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     &gt; version 2, the http server listening on port 8181 is no longer<br>
&gt; &gt;&gt;&gt;     &gt; needed.<br>
&gt; &gt;&gt;&gt;     &gt; When the old version is stopped and the new version started, there<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     will be<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     &gt; just one http server listening. The application is not aware of<br>
&gt; &gt;&gt;&gt;     &gt; the<br>
&gt; &gt;&gt;&gt;     &gt; previous state. What should we do so that the second http server<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     is removed<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     &gt; from Inventory?<br>
&gt; &gt;&gt;&gt;     &gt;<br>
&gt; &gt;&gt;&gt;     &gt; Thanks in advance.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     --<br>
&gt; &gt;&gt;&gt;     Lukas Krejci<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;     _______________________________________________<br>
&gt; &gt;&gt;&gt;     hawkular-dev mailing list<br>
&gt; &gt;&gt;&gt;     <a href="mailto:hawkular-dev@lists.jboss.org" target="_blank">hawkular-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:hawkular-dev@lists.jboss.org" target="_blank">hawkular-dev@lists.jboss.org</a>&gt;<br>
&gt; &gt;&gt;&gt;     <a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/hawkular-dev</a><br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; _______________________________________________<br>
&gt; &gt;&gt;&gt; hawkular-dev mailing list<br>
&gt; &gt;&gt;&gt; <a href="mailto:hawkular-dev@lists.jboss.org" target="_blank">hawkular-dev@lists.jboss.org</a><br>
&gt; &gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/hawkular-dev</a><br>
<br>
<br>
--<br>
Lukas Krejci<br>
<br>
_______________________________________________<br>
hawkular-dev mailing list<br>
<a href="mailto:hawkular-dev@lists.jboss.org" target="_blank">hawkular-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/hawkular-dev</a><br>
</blockquote></div>