Class: NewRelic::Agent::Configuration::HighSecuritySource

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

Constant Summary collapse

OFF =
'off'.freeze
RAW =
'raw'.freeze
OBFUSCATED =
'obfuscated'.freeze
SET_TO_OBFUSCATED =
[RAW, OBFUSCATED]

Instance Method Summary collapse

Methods inherited from DottedHash

#inspect, symbolize, #to_hash

Constructor Details

#initialize(local_settings) ⇒ HighSecuritySource

Returns a new instance of HighSecuritySource.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/new_relic/agent/configuration/high_security_source.rb', line 11

def initialize(local_settings)
  super({
    :capture_params => false,
    :'attributes.include' => [],

    :'transaction_tracer.record_sql' => record_sql_setting(local_settings, :'transaction_tracer.record_sql'),
    :'slow_sql.record_sql' => record_sql_setting(local_settings, :'slow_sql.record_sql'),
    :'mongo.obfuscate_queries' => true,
    :'elasticsearch.obfuscate_queries' => true,
    :'transaction_tracer.record_redis_arguments' => false,

    :'custom_insights_events.enabled' => false,
    :'strip_exception_messages.enabled' => true
  })
end

Instance Method Details

#record_sql_setting(local_settings, key) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/new_relic/agent/configuration/high_security_source.rb', line 33

def record_sql_setting(local_settings, key)
  original_value = local_settings[key]
  result = if SET_TO_OBFUSCATED.include?(original_value)
    OBFUSCATED
  else
    OFF
  end

  if result != original_value
    NewRelic::Agent.logger.info("Disabling setting #{key}='#{original_value}' because high security mode is enabled. Value will be '#{result}'")
  end

  result
end