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

[aws|elb] Add instrumentation support.

This commit is contained in:
Dan Peterson 2012-07-27 09:07:14 -03:00
parent 6cecc5f0a9
commit 542bfc4dea

View file

@ -16,7 +16,7 @@ module Fog
class ValidationError < Fog::Errors::Error; end
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/elb'
request :configure_health_check
@ -125,7 +125,9 @@ module Fog
@use_iam_profile = options[:use_iam_profile]
setup_credentials(options)
@connection_options = options[:connection_options] || {}
@instrumentor = options[:instrumentor]
@instrumentor_name = options[:instrumentor_name] || 'fog.aws.elb'
options[:region] ||= 'us-east-1'
@host = options[:host] || "elasticloadbalancing.#{options[:region]}.amazonaws.com"
@path = options[:path] || '/'
@ -169,6 +171,16 @@ module Fog
}
)
if @instrumentor
@instrumentor.instrument("#{@instrumentor_name}.request", params) do
_request(body, idempotent, parser)
end
else
_request(body, idempotent, parser)
end
end
def _request(body, idempotent, parser)
@connection.request({
:body => body,
:expects => 200,