Revert "Cloudwatch: Migrate to aws-sdk-go-v2" (#102738)

Revert "Cloudwatch: Migrate to aws-sdk-go-v2 (#99643)"

This reverts commit 5bb1d5f2c3.
This commit is contained in:
Stephanie Hingtgen
2025-03-24 19:11:04 +00:00
committed by GitHub
parent 53d355813e
commit 5dd0aa2c73
62 changed files with 1617 additions and 1495 deletions
+11 -5
View File
@@ -8,8 +8,7 @@ import (
"strings"
"time"
"github.com/aws/aws-sdk-go-v2/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/features"
@@ -89,7 +88,7 @@ func aggregateResponse(getMetricDataOutputs []*cloudwatch.GetMetricDataOutput) m
}
}
response.AddMetricDataResult(&r)
response.AddMetricDataResult(r)
responseByID[id] = response
}
}
@@ -229,9 +228,16 @@ func buildDataFrames(ctx context.Context, aggregatedResponse models.QueryRowResp
} else {
labels = getLabels(label, query, false)
}
timestamps := []*time.Time{}
points := []*float64{}
for j, t := range metric.Timestamps {
val := metric.Values[j]
timestamps = append(timestamps, t)
points = append(points, val)
}
timeField := data.NewField(data.TimeSeriesTimeFieldName, nil, metric.Timestamps)
valueField := data.NewField(data.TimeSeriesValueFieldName, labels, metric.Values)
timeField := data.NewField(data.TimeSeriesTimeFieldName, nil, timestamps)
valueField := data.NewField(data.TimeSeriesValueFieldName, labels, points)
// CloudWatch appends the dimensions to the returned label if the query label is not dynamic, so static labels need to be set
if hasStaticLabel {