On Thu, Oct 26, 2017 at 11:48 PM, John Mazzitelli <mazz(a)redhat.com> wrote:
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 :-)
I am not Joel, but jumping here, as we have thought on this too.
Do we want to split the Prometheus model ?
I mean, what if we consider a metricId also opaque, and we know that in P8S
is a combination of <metric_name><labels>, at the end of the day, is a
string and it is unique.
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.
So a metricId = "api_http_requests_total{method='POST',
handler='/messages'}" stored in the inventory will simplify tasks in other
layers as we can maintain the abstraction we are using today:
get_resource(resourceId).get_metric_id(metricId)
Or, I don'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.
[ps. this email was sent at 5:48pm on October 26, 2017]
_______________________________________________
hawkular-dev mailing list
hawkular-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hawkular-dev