class TingYun::Configuration::ServerSource
Constants
- TOP_LEVEL_KEYS
- TOP_LEVEL_KEYSV2
These keys appear outside of the agent_config hash in the connect response, but should still be merged in as config settings to the main agent configuration.
Public Class Methods
add_top_level_keys_for_testing(add_array)
click to toggle source
# File lib/ting_yun/configuration/server_source.rb, line 29 def self.add_top_level_keys_for_testing(add_array) TOP_LEVEL_KEYS.concat add_array end
new(connect_reply)
click to toggle source
Calls superclass method
TingYun::Configuration::DottedHash::new
# File lib/ting_yun/configuration/server_source.rb, line 37 def initialize(connect_reply) merged_settings = {} merge_top_level_keys(merged_settings, connect_reply) merge_agent_config_hash(merged_settings, connect_reply) filter_keys(merged_settings) # apply_feature_gates(merged_settings, connect_reply, existing_config) # The value under this key is a hash mapping transaction name strings # to apdex_t values. We don't want the nested hash to be flattened # as part of the call to super below, so it skips going through # merged_settings. # self[:web_transactions_apdex] = connect_reply['web_transactions_apdex'] # This causes keys in merged_settings to be symbolized and flattened super(merged_settings) end
remove_top_level_keys_for_testing(remove_arry)
click to toggle source
# File lib/ting_yun/configuration/server_source.rb, line 33 def self.remove_top_level_keys_for_testing(remove_arry) remove_arry.each{|i| TOP_LEVEL_KEYS.delete(i)} end
Public Instance Methods
filter_keys(merged_settings)
click to toggle source
# File lib/ting_yun/configuration/server_source.rb, line 75 def filter_keys(merged_settings) merged_settings.delete_if do |key, _| setting_spec = DEFAULTS[key.to_sym] if setting_spec if setting_spec[:allowed_from_server] false # it's allowed, so don't delete it else TingYun::Agent.logger.warn("Ignoring server-sent config for '#{key}' - this setting cannot be set from the server") true # delete it end else TingYun::Agent.logger.debug("Ignoring unrecognized config key from server: '#{key}'") true end end end
fix_transaction_threshold(merged_settings)
click to toggle source
# File lib/ting_yun/configuration/server_source.rb, line 68 def fix_transaction_threshold(merged_settings) # when value is "apdex_f" remove the config and defer to default if merged_settings['transaction_tracer.transaction_threshold'] =~ /apdex_f/i merged_settings.delete('transaction_tracer.transaction_threshold') end end
merge_agent_config_hash(merged_settings, connect_reply)
click to toggle source
# File lib/ting_yun/configuration/server_source.rb, line 62 def merge_agent_config_hash(merged_settings, connect_reply) if connect_reply['config'] merged_settings.merge!(connect_reply['config']) end end
merge_top_level_keys(merged_settings, connect_reply)
click to toggle source
# File lib/ting_yun/configuration/server_source.rb, line 54 def merge_top_level_keys(merged_settings, connect_reply) TOP_LEVEL_KEYS.each do |key_name| if connect_reply[key_name] merged_settings[key_name] = connect_reply[key_name] end end end