1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[AWS|Redshift] Add instrumentor

This commit is contained in:
Michael Hale 2014-09-16 14:00:25 -04:00
parent 07eee2f4d4
commit 5ce39d1daa

View file

@ -6,7 +6,7 @@ module Fog
extend Fog::AWS::CredentialFetcher::ServiceMethods
requires :aws_access_key_id, :aws_secret_access_key
recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at
recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :instrumentor, :instrumentor_name
request_path 'fog/aws/requests/redshift'
@ -78,6 +78,8 @@ module Fog
@region = options[:region] || 'us-east-1'
setup_credentials(options)
@instrumentor = options[:instrumentor]
@instrumentor_name = options[:instrumentor_name] || 'fog.aws.redshift'
@connection_options = options[:connection_options] || {}
@host = options[:host] || "redshift.#{@region}.amazonaws.com"
@version = '2012-12-01'
@ -111,9 +113,19 @@ module Fog
params[:headers]['x-amz-redshift-version'] = @version
params[:headers]['x-amz-security-token'] = @aws_session_token if @aws_session_token
params[:headers]['Authorization'] = @signer.sign params, date
params[:parser] = parser
response = @connection.request(params.merge(:parser => parser), &block)
response
if @instrumentor
@instrumentor.instrument("#{@instrumentor_name}.request", params) do
_request(params, &block)
end
else
_request(params, &block)
end
end
def _request(params, &block)
@connection.request(params, &block)
end
end
end