|
|
|
@ -99,7 +99,12 @@ func NewInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst |
|
|
|
|
return nil, fmt.Errorf("error reading settings: %w", err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
httpClient, err := httpClientProvider.New() |
|
|
|
|
opts, err := settings.HTTPClientOptions() |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
httpClient, err := httpClientProvider.New(opts) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, fmt.Errorf("error creating http client: %w", err) |
|
|
|
|
} |
|
|
|
@ -245,9 +250,9 @@ func (e *cloudWatchExecutor) newSession(pluginCtx backend.PluginContext, region |
|
|
|
|
region = instance.Settings.Region |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return e.sessions.GetSession(awsds.SessionConfig{ |
|
|
|
|
sess, err := e.sessions.GetSession(awsds.SessionConfig{ |
|
|
|
|
// https://github.com/grafana/grafana/issues/46365
|
|
|
|
|
// HTTPClient: dsInfo.HTTPClient,
|
|
|
|
|
// HTTPClient: instance.HTTPClient,
|
|
|
|
|
Settings: awsds.AWSDatasourceSettings{ |
|
|
|
|
Profile: instance.Settings.Profile, |
|
|
|
|
Region: region, |
|
|
|
@ -261,6 +266,17 @@ func (e *cloudWatchExecutor) newSession(pluginCtx backend.PluginContext, region |
|
|
|
|
}, |
|
|
|
|
UserAgentName: aws.String("Cloudwatch"), |
|
|
|
|
}) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// work around until https://github.com/grafana/grafana/issues/39089 is implemented
|
|
|
|
|
if e.cfg.SecureSocksDSProxy.Enabled && e.features.IsEnabled(featuremgmt.FlagSecureSocksDatasourceProxy) && instance.Settings.SecureSocksProxyEnabled { |
|
|
|
|
// only update the transport to try to avoid the issue mentioned here https://github.com/grafana/grafana/issues/46365
|
|
|
|
|
sess.Config.HTTPClient.Transport = instance.HTTPClient.Transport |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return sess, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (e *cloudWatchExecutor) getInstance(pluginCtx backend.PluginContext) (*DataSource, error) { |
|
|
|
|