Hi Christopher, On Wed, Jan 20, 2021 at 04:55:59PM +0100, Christopher Faulet wrote: > Here is an attempt to simplify the metrics matrices definition. Instead of > having multiple arrays to define the metrics names and type, there is now > only 2 arrays. One for the global metrics and another one for the > frontend/backend/server metrics. And there is no longer a custom order. > > For now, labels and descriptions are still defined apart. I guess, we will > be able to simply the descriptions part using the ones from the stats > module, overriding only some when necessary. For the labels, I guess we > should think about it a bit to have something more flexible.
yes I was planning to remove all descriptions by default, and make sure we find a common one; ideally we should not have any difference here, that's also why I added the fields to replace the "MB" notion. for the labels, I started a poc for #1029, to see how things could look like. For now I added an argument to dump_metric and pass it an IST for extra labels to concat. good that you based your patches on top of my last batch, thanks! > From 1b5e0dad1cdd9c1f2196a3ce55a84bd1aea0598f Mon Sep 17 00:00:00 2001 > From: Christopher Faulet <cfau...@haproxy.com> > Date: Wed, 20 Jan 2021 15:28:22 +0100 > Subject: [PATCH 1/4] MINOR: contrib/prometheus-exporter: Don't needlessly set > empty label for metrics > > There is no reason to define empty labels for metrics. By default, all labels > are initialized to an empty ist. definitely a good cleaning I also had in mind. Reviewed-by: William Dauchy <wdau...@gmail.com> > From c53078675bab24fbefcbfa1f7ad8f8c95bd04d72 Mon Sep 17 00:00:00 2001 > From: Christopher Faulet <cfau...@haproxy.com> > Date: Wed, 20 Jan 2021 15:02:50 +0100 > Subject: [PATCH 2/4] MINOR: contrib/prometheus-exporter: Split the > PROMEX_FL_STATS_METRIC flag > > PROMEX_FL_STATS_METRIC flag is splitted in 3 flags to easily identify the > processed entity type (frontend, backend or server). Thus, now we are using > PROMEX_FL_FRONT_METRIC, PROMEX_FL_BACK_METRIC or PROMEX_FL_SRV_METRIC. These > flags will be used to know if a metric is defined and must be exported for a > given entity type. Reviewed-by: William Dauchy <wdau...@gmail.com> > From 26111899589f517a5656573260c99187fb14841f Mon Sep 17 00:00:00 2001 > From: Christopher Faulet <cfau...@haproxy.com> > Date: Wed, 20 Jan 2021 15:19:12 +0100 > Subject: [PATCH 3/4] MINOR: contrib/prometheus-exporter: Add promex_metric > struct defining a metric > > This structure will be used to define a Prometheus metric, i.e its name, its > type (gauge or counter) and its flags. The flags will be used to know for > which entities the metric is defined (global, frontend, backend and/or > server). Reviewed-by: William Dauchy <wdau...@gmail.com> > From db99dbd8ddeebadacaae58a7a21de628295fc36b Mon Sep 17 00:00:00 2001 > From: Christopher Faulet <cfau...@haproxy.com> > Date: Wed, 20 Jan 2021 15:20:53 +0100 > Subject: [PATCH 4/4] MEDIUM: contrib/prometheus-exporter: Rework matrices > defining Promex metrics > > The global and stats matrices are replaced by a simpler ones. Now we have > only 2 arrays of prometheus metrics. Their flags are used to match on the > entity type. This simplify a bit the metrics definition. For now, labels and > descriptions are still outside of these arrays, because the labels must be > reworked to be more dynamic and the descrptions must be replaced by stats > ones as far as possible. Reviewed-by: William Dauchy <wdau...@gmail.com> I have not tested them but from what I see it should really much change the current output, even the order. That being said, it looks definitely simpler to me. I will continue my work once you have merged this series. -- William