@@ -50,7 +50,7 @@ func (r *QueryResult) generateMetricUniqueKey(facets map[string]interface{}, suf
50
50
return fmt .Sprintf ("%s%s" , r .generateMetricName (suffix ), string (jsonData ))
51
51
}
52
52
53
- func (r * QueryResult ) createMetric (facets map [string ]interface {}, suffix string ) (string , metricStatus ) {
53
+ func (r * QueryResult ) createMetric (facets map [string ]interface {}, suffix string , help string ) (string , metricStatus ) {
54
54
metricName := r .generateMetricName (suffix )
55
55
resultKey := r .generateMetricUniqueKey (facets , suffix )
56
56
@@ -64,10 +64,14 @@ func (r *QueryResult) createMetric(facets map[string]interface{}, suffix string)
64
64
return resultKey , registered
65
65
}
66
66
67
+ if len (help ) == 0 {
68
+ help = "Result of an SQL query"
69
+ }
70
+
67
71
fmt .Println ("Creating" , resultKey )
68
72
r .Result [resultKey ] = prometheus .NewGauge (prometheus.GaugeOpts {
69
73
Name : fmt .Sprintf ("query_result_%s" , metricName ),
70
- Help : "Result of an SQL query" ,
74
+ Help : help ,
71
75
ConstLabels : labels ,
72
76
})
73
77
return resultKey , unregistered
@@ -164,7 +168,7 @@ func (r *QueryResult) SetMetrics(recs records, valueOnError string) error {
164
168
return errors .New ("Data field not found in result set" )
165
169
}
166
170
167
- key , status := r .createMetric (facet , suffix )
171
+ key , status := r .createMetric (facet , suffix , r . Query . Help )
168
172
err := setValueForResult (r .Result [key ], dataVal )
169
173
if err != nil {
170
174
return err
0 commit comments