mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|cloud_watch] Add instrumentation support.
This commit is contained in:
parent
050e36283b
commit
545ba0dd3d
1 changed files with 15 additions and 1 deletions
|
@ -6,7 +6,7 @@ module Fog
|
||||||
extend Fog::AWS::CredentialFetcher::ServiceMethods
|
extend Fog::AWS::CredentialFetcher::ServiceMethods
|
||||||
|
|
||||||
requires :aws_access_key_id, :aws_secret_access_key
|
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/cloud_watch'
|
request_path 'fog/aws/requests/cloud_watch'
|
||||||
|
|
||||||
|
@ -94,6 +94,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.cloud_watch'
|
||||||
|
|
||||||
options[:region] ||= 'us-east-1'
|
options[:region] ||= 'us-east-1'
|
||||||
@host = options[:host] || "monitoring.#{options[:region]}.amazonaws.com"
|
@host = options[:host] || "monitoring.#{options[:region]}.amazonaws.com"
|
||||||
@path = options[:path] || '/'
|
@path = options[:path] || '/'
|
||||||
|
@ -136,6 +140,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({
|
@connection.request({
|
||||||
:body => body,
|
:body => body,
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
Loading…
Add table
Reference in a new issue