Skip to content

Commit

Permalink
add wait time and remove unused method
Browse files Browse the repository at this point in the history
  • Loading branch information
movence committed Apr 3, 2024
1 parent 2342634 commit a3f04c7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 36 deletions.
2 changes: 1 addition & 1 deletion test/gpu/nvidia_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (t *NvidiaTestRunner) GetAgentConfigFileName() string {
}

func (t *NvidiaTestRunner) GetAgentRunDuration() time.Duration {
return 0
return 3 * time.Minute
}

func (t *NvidiaTestRunner) GetMeasuredMetrics() []string {
Expand Down
35 changes: 0 additions & 35 deletions test/metric/metric_list_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,3 @@ func (n *Fetcher) Fetch(namespace, metricName string, dimensions []types.Dimensi
log.Printf("total number of metrics fetched: %v", len(metrics))
return metrics, nil
}

func (n *Fetcher) FetchByDimension(namespace string, dimensions []types.Dimension) ([]types.Metric, error) {
var dims []types.DimensionFilter
for _, dim := range dimensions {
dims = append(dims, types.DimensionFilter{
Name: dim.Name,
Value: dim.Value,
})
}

listMetricInput := cloudwatch.ListMetricsInput{
Namespace: aws.String(namespace),
Dimensions: dims,
}

log.Printf("Metric data input: namespace %v, dimensions %v", namespace, fmt.Sprint(&dims))

var metrics []types.Metric
for {
// get a complete list of metrics with given dimensions
output, err := awsservice.CwmClient.ListMetrics(context.Background(), &listMetricInput)
if err != nil {
return nil, fmt.Errorf("Error getting metric data %v", err)
}
metrics = append(metrics, output.Metrics...)
// nil or empty nextToken means there is no more data to be fetched
nextToken := output.NextToken
if nextToken == nil || *nextToken == "" {
break
}
listMetricInput.NextToken = nextToken
}
log.Printf("total number of metrics fetched: %v", len(metrics))
return metrics, nil
}

0 comments on commit a3f04c7

Please sign in to comment.