From 30dc4025c2eda715ce595f868cc553db0586418d Mon Sep 17 00:00:00 2001 From: Andres Martinez Gotor Date: Fri, 2 Jul 2021 10:13:23 +0200 Subject: [PATCH] Remove AWS CW client cache (#36311) --- pkg/tsdb/cloudwatch/cloudwatch.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/pkg/tsdb/cloudwatch/cloudwatch.go b/pkg/tsdb/cloudwatch/cloudwatch.go index daf6baa3782..445b800da94 100644 --- a/pkg/tsdb/cloudwatch/cloudwatch.go +++ b/pkg/tsdb/cloudwatch/cloudwatch.go @@ -157,9 +157,6 @@ func NewInstanceSettings() datasource.InstanceFactoryFunc { // cloudWatchExecutor executes CloudWatch requests. type cloudWatchExecutor struct { - ec2Client ec2iface.EC2API - rgtaClient resourcegroupstaggingapiiface.ResourceGroupsTaggingAPIAPI - logsService *LogsService im instancemgmt.InstanceManager cfg *setting.Cfg @@ -209,32 +206,22 @@ func (e *cloudWatchExecutor) getCWLogsClient(region string, pluginCtx backend.Pl } func (e *cloudWatchExecutor) getEC2Client(region string, pluginCtx backend.PluginContext) (ec2iface.EC2API, error) { - if e.ec2Client != nil { - return e.ec2Client, nil - } - sess, err := e.newSession(region, pluginCtx) if err != nil { return nil, err } - e.ec2Client = newEC2Client(sess) - return e.ec2Client, nil + return newEC2Client(sess), nil } func (e *cloudWatchExecutor) getRGTAClient(region string, pluginCtx backend.PluginContext) (resourcegroupstaggingapiiface.ResourceGroupsTaggingAPIAPI, error) { - if e.rgtaClient != nil { - return e.rgtaClient, nil - } - sess, err := e.newSession(region, pluginCtx) if err != nil { return nil, err } - e.rgtaClient = newRGTAClient(sess) - return e.rgtaClient, nil + return newRGTAClient(sess), nil } func (e *cloudWatchExecutor) alertQuery(ctx context.Context, logsClient cloudwatchlogsiface.CloudWatchLogsAPI,