Class: Aws::Plugins::ClientMetricsPlugin Private

Inherits:
Seahorse::Client::Plugin show all
Defined in:
lib/aws-sdk-core/plugins/client_metrics_plugin.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Handler

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Plugin

#add_options, #after_initialize, after_initialize, after_initialize_hooks, before_initialize, #before_initialize, before_initialize_hooks, handlers, literal, option, options

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response, #handler_for, #new_handler

Class Method Details

.resolve_client_id(cfg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



115
116
117
118
119
120
121
# File 'lib/aws-sdk-core/plugins/client_metrics_plugin.rb', line 115

def self.resolve_client_id(cfg)
  default = ""
  env_source = ENV["AWS_CSM_CLIENT_ID"]
  env_source = nil if env_source == ""
  cfg_source = Aws.shared_config.csm_client_id(profile: cfg.profile)
  env_source || cfg_source || default
end

.resolve_client_side_monitoring(cfg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/aws-sdk-core/plugins/client_metrics_plugin.rb', line 101

def self.resolve_client_side_monitoring(cfg)
  env_source = ENV["AWS_CSM_ENABLED"]
  env_source = nil if env_source == ""
  if env_source.is_a?(String) && (env_source.downcase == "false" || env_source.downcase == "f")
    env_source = false
  end
  cfg_source = Aws.shared_config.csm_enabled(profile: cfg.profile)
  if env_source || cfg_source
    true
  else
    false
  end
end

.resolve_client_side_monitoring_host(cfg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/aws-sdk-core/plugins/client_metrics_plugin.rb', line 88

def self.resolve_client_side_monitoring_host(cfg)
  env_source = ENV["AWS_CSM_HOST"]
  env_source = nil if env_source == ""
  cfg_source = Aws.shared_config.csm_host(profile: cfg.profile)
  if env_source
    env_source
  elsif cfg_source
    cfg_source
  else
    "127.0.0.1"
  end
end

.resolve_client_side_monitoring_port(cfg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/aws-sdk-core/plugins/client_metrics_plugin.rb', line 75

def self.resolve_client_side_monitoring_port(cfg)
  env_source = ENV["AWS_CSM_PORT"]
  env_source = nil if env_source == ""
  cfg_source = Aws.shared_config.csm_port(profile: cfg.profile)
  if env_source
    env_source.to_i
  elsif cfg_source
    cfg_source.to_i
  else
    31000
  end
end

.resolve_publisher(cfg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



71
72
73
# File 'lib/aws-sdk-core/plugins/client_metrics_plugin.rb', line 71

def self.resolve_publisher(cfg)
  ClientSideMonitoring::Publisher.new
end

Instance Method Details

#add_handlers(handlers, config) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



61
62
63
64
65
66
67
68
# File 'lib/aws-sdk-core/plugins/client_metrics_plugin.rb', line 61

def add_handlers(handlers, config)
  if config.client_side_monitoring && config.client_side_monitoring_port
    handlers.add(Handler, step: :initialize)
    publisher = config.client_side_monitoring_publisher
    publisher.agent_port = config.client_side_monitoring_port
    publisher.agent_host = config.client_side_monitoring_host
  end
end