@@ -79,6 +79,11 @@ func (q *Query) Run(conn *connection) error {
7979
8080// updateMetrics parses the result set and returns a slice of const metrics
8181func (q * Query ) updateMetrics (conn * connection , res map [string ]interface {}) ([]prometheus.Metric , error ) {
82+ // if no value were defined to be parsed, return immediately
83+ if len (q .Values ) == 0 {
84+ level .Debug (q .log ).Log ("msg" , "No values defined in configuration, skipping metric update" )
85+ return nil , nil
86+ }
8287 updated := 0
8388 metrics := make ([]prometheus.Metric , 0 , len (q .Values ))
8489 for _ , valueName := range q .Values {
@@ -172,7 +177,7 @@ func (q *Query) updateMetric(conn *connection, res map[string]interface{}, value
172177 labels = append (labels , conn .user )
173178 labels = append (labels , valueName )
174179 // create a new immutable const metric that can be cached and returned on
175- // every scrape. Remember that the order of the lable values in the labels
180+ // every scrape. Remember that the order of the label values in the labels
176181 // slice must match the order of the label names in the descriptor!
177182 metric , err := prometheus .NewConstMetric (
178183 q .desc , prometheus .GaugeValue , value , labels ... ,
0 commit comments