[Hawkular-dev] change to inventory metric model to store Prometheus info

John Mazzitelli mazz at redhat.com
Thu Oct 26 17:48:08 EDT 2017


I *think* I'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's metric data and from there you will get the Prometheus metric family+labels so you know what you need to ask Prometheus for.

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:

        // don't copy properties - we are using the inventory properties for P labels right now
        //m.getProperties().forEach((k, v) -> mb.property(k, v.toString()));

        // map to the Prometheus metric timeseries
        mb.property("hawkular.metric.family", m.getMetricFamily());
        mb.properties(m.getMetricLabels());

The object "m" is the agent's own Metric object that has a generic properties map. Right now I don't think we store anything in there so that commented portion of the code is no big deal at the moment.

But notice the metric family name and the metric labels are all in the same generic properties for the inventory Metric object (that's what mb is).

I don't like this. It means who ever queries inventory has to strip out the "hawkular.metric.family" key from the metric generic properties - the rest of the map are the real labels.

I think we should make these first-class attributes in the inventory model:

mb.metricFamily(m.getMetricFamily())
mb.metricLabels(m.getMetricLabels())

Thoughts? (looking at you Joel :-)

[ps. this email was sent at 5:48pm on October 26, 2017]


More information about the hawkular-dev mailing list