in util/awsservice/cloudwatchmetrics.go [75:107]
func ValidateSampleCount(metricName, namespace string, dimensions []types.Dimension,
startTime time.Time, endTime time.Time,
lowerBoundInclusive int, upperBoundInclusive int, periodInSeconds int32) bool {
metricStatsInput := cloudwatch.GetMetricStatisticsInput{
MetricName: aws.String(metricName),
Namespace: aws.String(namespace),
StartTime: aws.Time(startTime),
EndTime: aws.Time(endTime),
Period: aws.Int32(periodInSeconds),
Dimensions: dimensions,
Statistics: []types.Statistic{types.StatisticSampleCount},
}
data, err := CwmClient.GetMetricStatistics(ctx, &metricStatsInput)
if err != nil {
return false
}
dataPoints := 0
log.Printf("These are the data points: %v", data)
log.Printf("These are the data points: %v", data.Datapoints)
for _, datapoint := range data.Datapoints {
dataPoints = dataPoints + int(*datapoint.SampleCount)
}
log.Printf("Number of datapoints for start time %v with endtime %v and period %d is %d is inclusive between %d and %d", startTime, endTime, periodInSeconds, dataPoints, lowerBoundInclusive, upperBoundInclusive)
if lowerBoundInclusive <= dataPoints && dataPoints <= upperBoundInclusive {
return true
}
return false
}