Le 22/12/2020 à 14:49, Willy Tarreau a écrit :

By the way I just had a look at the dump function in prometheus, I
don't understand why it's reimplenting all the info filling by itself.
We could seriously simplify things by calling stats_fill_info() once,
then iterating over all the metrics, possibly performing adjustments
for the rare ones that require an exception. What I'm seeing is that
they use different names but we could possibly extend the struct
associating the names and descriptions to make them match the two use
cases. I hate to see that new fields are added to the global stats
from time to time and that they don't show up in prometheus because
the work has to be done there again. Otherwise if we want to keep it
distinct, it must not use the current stats definitions. But that's
more of a mid-term cleanup that is not directly related to your patch,
though it certainly is the reason why it causes a colatteral impact
on the stats.


Relying on stats_fill_info() is a good idea indeed. Info metrics may be adapted if required when dumped. Because the global metrics are probably always fully dumped in one time, it is not a problem. And because the descriptions are now part of the stats, we should rely on it as far as possible. For global, proxy and server metrics. For the metrics name, the name_desc structure may be extended (or a new one created). But we should still be prepared to handle exceptions. For instance, the unit must be part of the Prometheus metrics name, and the unit may differ between the internal stats and Prometheus output.

--
Christopher Faulet

Reply via email to