Class: NewRelic::Agent::Configuration::ServerSource

Inherits:
DottedHash
  • Object
show all
Defined in:
lib/new_relic/agent/configuration/server_source.rb

Instance Method Summary collapse

Methods inherited from DottedHash

#inspect, #to_hash

Constructor Details

#initialize(hash) ⇒ ServerSource

Returns a new instance of ServerSource.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/new_relic/agent/configuration/server_source.rb', line 5

def initialize(hash)
  if hash['agent_config']
    if hash['agent_config']['transaction_tracer.transaction_threshold'] =~ /apdex_f/i
      # when value is "apdex_f" remove the config and defer to default
      hash['agent_config'].delete('transaction_tracer.transaction_threshold')
    end
    super(hash.delete('agent_config'))
  end

  string_map = [
     ['collect_traces', 'transaction_tracer.enabled'],
     ['collect_traces', 'slow_sql.enabled'],
     ['collect_errors', 'error_collector.enabled']
  ].each do |pair|
    hash[pair[1]] = hash[pair[0]] if hash[pair[0]] != nil
  end

  if hash['web_transactions_apdex']
    self[:web_transactions_apdex] = hash.delete('web_transactions_apdex')
  end

  super
end