2
0
Эх сурвалжийг харах

Wrap user tag columns in quotes

Signed-off-by: Sean Holcomb <seanholcomb@gmail.com>
Sean Holcomb 2 жил өмнө
parent
commit
b2c0c88695

+ 8 - 3
pkg/cloud/aws/athenaintegration.go

@@ -94,8 +94,9 @@ func (ai *AthenaIntegration) GetCloudCost(start, end time.Time) (*opencost.Cloud
 	// of columns to query.
 	for column := range allColumns {
 		if strings.HasPrefix(column, LabelColumnPrefix) {
-			groupByColumns = append(groupByColumns, column)
-			aqi.TagColumns = append(aqi.TagColumns, column)
+			quotedTag := fmt.Sprintf(`"%s"`, column)
+			groupByColumns = append(groupByColumns, quotedTag)
+			aqi.TagColumns = append(aqi.TagColumns, quotedTag)
 		}
 	}
 	var selectColumns []string
@@ -334,7 +335,11 @@ func (ai *AthenaIntegration) RowToCloudCost(row types.Row, aqi AthenaQueryIndexe
 	labels := opencost.CloudCostLabels{}
 	labelValues := []string{}
 	for _, tagColumnName := range aqi.TagColumns {
-		labelName := strings.TrimPrefix(tagColumnName, LabelColumnPrefix)
+		// remove quotes
+		labelName := strings.TrimPrefix(tagColumnName, `"`)
+		labelName = strings.TrimSuffix(tagColumnName, `"`)
+		// remove prefix
+		labelName = strings.TrimPrefix(tagColumnName, LabelColumnPrefix)
 		value := GetAthenaRowValue(row, aqi.ColumnIndexes, tagColumnName)
 		if value != "" {
 			labels[labelName] = value