<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 26, 2017 at 11:48 PM, John Mazzitelli <span dir="ltr">&lt;<a href="mailto:mazz@redhat.com" target="_blank">mazz@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I *think* I&#39;m almost at the point where our inventory is able to store Prometheus metric data (metric family name and labels) in our inventory. Once done, you need only query inventory to get a resource&#39;s metric data and from there you will get the Prometheus metric family+labels so you know what you need to ask Prometheus for.<br>
<br>
Currently, there is no place in our Metric domain object in inventory for this information. Right now I am putting it in that generic properties:<br>
<br>
        // don&#39;t copy properties - we are using the inventory properties for P labels right now<br>
        //m.getProperties().forEach((<wbr>k, v) -&gt; mb.property(k, v.toString()));<br>
<br>
        // map to the Prometheus metric timeseries<br>
        mb.property(&quot;hawkular.metric.<wbr>family&quot;, m.getMetricFamily());<br>
        mb.properties(m.<wbr>getMetricLabels());<br>
<br>
The object &quot;m&quot; is the agent&#39;s own Metric object that has a generic properties map. Right now I don&#39;t think we store anything in there so that commented portion of the code is no big deal at the moment.<br>
<br>
But notice the metric family name and the metric labels are all in the same generic properties for the inventory Metric object (that&#39;s what mb is).<br>
<br>
I don&#39;t like this. It means who ever queries inventory has to strip out the &quot;hawkular.metric.family&quot; key from the metric generic properties - the rest of the map are the real labels.<br>
<br>
I think we should make these first-class attributes in the inventory model:<br>
<br>
mb.metricFamily(m.<wbr>getMetricFamily())<br>
mb.metricLabels(m.<wbr>getMetricLabels())<br>
<br>
Thoughts? (looking at you Joel :-)<br></blockquote><div><br></div><div>I am not Joel, but jumping here, as we have thought on this too.<br></div><div><br></div><div>Do we want to split the Prometheus model ?</div><div><br></div><div>I mean, what if we consider a metricId also opaque, and we know that in P8S is a combination of &lt;metric_name&gt;&lt;labels&gt;, at the end of the day, is a string and it is unique.</div><div><br></div><div>I ask this, because if we expose the details, it will be tempted to start manipulating IDs in other layers, and perhaps that will create technical debt.</div><div><br></div><div>So a metricId = &quot;api_http_requests_total{method=&#39;POST&#39;, handler=&#39;/messages&#39;}&quot; stored in the inventory will simplify tasks in other layers as we can maintain the abstraction we are using today:</div><div><br></div><div>get_resource(resourceId).get_metric_id(metricId)</div><div><br></div><div>Or, I don&#39;t know if we can combine, maintaining an opaque metricId to continue the model, and adding family and labels as properties/context in those use cases are necessary. </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
[ps. this email was sent at 5:48pm on October 26, 2017]<br>
______________________________<wbr>_________________<br>
hawkular-dev mailing list<br>
<a href="mailto:hawkular-dev@lists.jboss.org">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/<wbr>mailman/listinfo/hawkular-dev</a><br>
</blockquote></div><br></div></div>