Skip to content

Commit

Permalink
[aws|auto_scaling] Add instrumentation support.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehale committed Sep 11, 2012
1 parent eb700e6 commit 4d2b2a4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/fog/aws/auto_scaling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ResourceInUse < Fog::Errors::Error; end
class ValidationError < Fog::Errors::Error; end

requires :aws_access_key_id, :aws_secret_access_key
recognizes :host, :path, :port, :scheme, :persistent, :region, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at
recognizes :host, :path, :port, :scheme, :persistent, :region, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :instrumentor, :instrumentor_name

request_path 'fog/aws/requests/auto_scaling'
request :create_auto_scaling_group
Expand Down Expand Up @@ -79,6 +79,10 @@ def initialize(options={})
setup_credentials(options)

@connection_options = options[:connection_options] || {}

@instrumentor = options[:instrumentor]
@instrumentor_name = options[:instrumentor_name] || 'fog.aws.auto_scaling'

options[:region] ||= 'us-east-1'
@host = options[:host] || "autoscaling.#{options[:region]}.amazonaws.com"
@path = options[:path] || '/'
Expand Down Expand Up @@ -113,6 +117,16 @@ def request(params)
}
)

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)
begin
response = @connection.request({
:body => body,
Expand Down

0 comments on commit 4d2b2a4

Please sign in to comment.