sql_exporter icon indicating copy to clipboard operation
sql_exporter copied to clipboard

added extraction of labels from JSON column

Open samsk opened this issue 6 years ago • 1 comments

Hi, you might not like it, but I've implemented it works ;-)

This change introduces new metric option json_labels that specified a column that should be used to extract additional labels to metric, without the need to name them one by one in the query. If some style/whatever changes needed to merge it, I'll make them.

samsk avatar Jul 11 '19 08:07 samsk

  1. yes you can, but than you have to change configuration. I kind a like it, when everything about database is declared in database, even what is monitored and what labels it has - ie. if there is bool metric (ok/down), than the evaluation logic should be in database view and not in the query in some config file - and if it is so, why not to extend this logic to labels ;-)

  2. Regarding fully dynamic labels - I know that prometheus will refuse different labels for the same metric and that is correct and expected. They should not be absolutely dynamic.

But ok, thanks for your review.

samsk avatar Jul 16 '19 11:07 samsk