Explorar el Código

Fixes from Nikos comments

Sean Holcomb hace 5 años
padre
commit
cd1f1115db
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      pkg/prom/result.go

+ 3 - 2
pkg/prom/result.go

@@ -240,7 +240,7 @@ func (qr *QueryResult) GetLabels() map[string]string {
 			continue
 		}
 
-		label := k[6:]
+		label := strings.TrimPrefix(k, "label_")
 		value, ok := v.(string)
 		if !ok {
 			log.Warningf("Failed to parse label value for label: '%s'", label)
@@ -253,6 +253,7 @@ func (qr *QueryResult) GetLabels() map[string]string {
 	return result
 }
 
+// GetAnnotations returns all annotations and their values from the query result
 func (qr *QueryResult) GetAnnotations() map[string]string {
 	result := make(map[string]string)
 
@@ -262,7 +263,7 @@ func (qr *QueryResult) GetAnnotations() map[string]string {
 			continue
 		}
 
-		annotations := k[11:]
+		annotations := strings.TrimPrefix(k, "annotation_")
 		value, ok := v.(string)
 		if !ok {
 			log.Warningf("Failed to parse label value for label: '%s'", annotations)