Skip to content

Commit 792e999

Browse files
authored
tsdb/cloudwatch: always return underlying metrics query errors (grafana#24632)
* tsdb/cloudwatch: always return underlying errors
1 parent 0f964c0 commit 792e999

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/tsdb/cloudwatch/metric_find_query.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,11 @@ func (e *CloudWatchExecutor) ensureClientSession(region string) error {
471471
dsInfo := e.getDsInfo(region)
472472
cfg, err := getAwsConfig(dsInfo)
473473
if err != nil {
474-
return fmt.Errorf("Failed to call ec2:getAwsConfig, %v", err)
474+
return fmt.Errorf("Failed to call ec2:getAwsConfig, %w", err)
475475
}
476476
sess, err := session.NewSession(cfg)
477477
if err != nil {
478-
return fmt.Errorf("Failed to call ec2:NewSession, %v", err)
478+
return fmt.Errorf("Failed to call ec2:NewSession, %w", err)
479479
}
480480
e.ec2Svc = ec2.New(sess, cfg)
481481
}
@@ -597,11 +597,11 @@ func (e *CloudWatchExecutor) ensureRGTAClientSession(region string) error {
597597
dsInfo := e.getDsInfo(region)
598598
cfg, err := getAwsConfig(dsInfo)
599599
if err != nil {
600-
return fmt.Errorf("Failed to call ec2:getAwsConfig, %v", err)
600+
return fmt.Errorf("Failed to call ec2:getAwsConfig, %w", err)
601601
}
602602
sess, err := session.NewSession(cfg)
603603
if err != nil {
604-
return fmt.Errorf("Failed to call ec2:NewSession, %v", err)
604+
return fmt.Errorf("Failed to call ec2:NewSession, %w", err)
605605
}
606606
e.rgtaSvc = resourcegroupstaggingapi.New(sess, cfg)
607607
}
@@ -677,7 +677,7 @@ func (e *CloudWatchExecutor) cloudwatchListMetrics(region string, namespace stri
677677
return !lastPage
678678
})
679679
if err != nil {
680-
return nil, fmt.Errorf("Failed to call cloudwatch:ListMetrics, %v", err)
680+
return nil, fmt.Errorf("Failed to call cloudwatch:ListMetrics, %w", err)
681681
}
682682

683683
return &resp, nil
@@ -699,7 +699,7 @@ func (e *CloudWatchExecutor) ec2DescribeInstances(region string, filters []*ec2.
699699
return !lastPage
700700
})
701701
if err != nil {
702-
return nil, errors.New("Failed to call ec2:DescribeInstances")
702+
return nil, fmt.Errorf("Failed to call ec2:DescribeInstances, %w", err)
703703
}
704704

705705
return &resp, nil
@@ -721,7 +721,7 @@ func (e *CloudWatchExecutor) resourceGroupsGetResources(region string, filters [
721721
return !lastPage
722722
})
723723
if err != nil {
724-
return nil, errors.New("Failed to call tags:GetResources")
724+
return nil, fmt.Errorf("Failed to call tags:GetResources, %w", err)
725725
}
726726

727727
return &resp, nil

0 commit comments

Comments
 (0)