mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #1140 from mikehale/asg-instrumentation
[aws|auto_scaling] Add instrumentation support.
This commit is contained in:
commit
dc28c7be85
1 changed files with 15 additions and 1 deletions
|
@ -10,7 +10,7 @@ module Fog
|
||||||
class ValidationError < Fog::Errors::Error; end
|
class ValidationError < Fog::Errors::Error; end
|
||||||
|
|
||||||
requires :aws_access_key_id, :aws_secret_access_key
|
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_path 'fog/aws/requests/auto_scaling'
|
||||||
request :create_auto_scaling_group
|
request :create_auto_scaling_group
|
||||||
|
@ -79,6 +79,10 @@ module Fog
|
||||||
setup_credentials(options)
|
setup_credentials(options)
|
||||||
|
|
||||||
@connection_options = options[:connection_options] || {}
|
@connection_options = options[:connection_options] || {}
|
||||||
|
|
||||||
|
@instrumentor = options[:instrumentor]
|
||||||
|
@instrumentor_name = options[:instrumentor_name] || 'fog.aws.auto_scaling'
|
||||||
|
|
||||||
options[:region] ||= 'us-east-1'
|
options[:region] ||= 'us-east-1'
|
||||||
@host = options[:host] || "autoscaling.#{options[:region]}.amazonaws.com"
|
@host = options[:host] || "autoscaling.#{options[:region]}.amazonaws.com"
|
||||||
@path = options[:path] || '/'
|
@path = options[:path] || '/'
|
||||||
|
@ -113,6 +117,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)
|
||||||
begin
|
begin
|
||||||
response = @connection.request({
|
response = @connection.request({
|
||||||
:body => body,
|
:body => body,
|
||||||
|
|
Loading…
Reference in a new issue