Class: NewRelic::Control::SecurityInterface
- Inherits:
-
Object
- Object
- NewRelic::Control::SecurityInterface
- Includes:
- Singleton
- Defined in:
- lib/new_relic/control/security_interface.rb
Constant Summary collapse
- SUPPORTABILITY_PREFIX_SECURITY =
'Supportability/Ruby/SecurityAgent/Enabled/'
- SUPPORTABILITY_PREFIX_SECURITY_AGENT =
'Supportability/Ruby/SecurityAgent/Agent/Enabled/'
- ENABLED =
'enabled'
- DISABLED =
'disabled'
Instance Attribute Summary collapse
-
#wait ⇒ Object
Returns the value of attribute wait.
Instance Method Summary collapse
- #agent_started? ⇒ Boolean
- #init_agent ⇒ Object
- #record_supportability_metrics ⇒ Object
- #security_agent_metric(setting) ⇒ Object
- #waiting? ⇒ Boolean
Instance Attribute Details
#wait ⇒ Object
Returns the value of attribute wait.
12 13 14 |
# File 'lib/new_relic/control/security_interface.rb', line 12 def wait @wait end |
Instance Method Details
#agent_started? ⇒ Boolean
19 20 21 |
# File 'lib/new_relic/control/security_interface.rb', line 19 def agent_started? (@agent_started ||= false) == true end |
#init_agent ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/new_relic/control/security_interface.rb', line 27 def init_agent return if agent_started? || waiting? record_supportability_metrics if Agent.config[:'security.agent.enabled'] && !Agent.config[:high_security] Agent.logger.info('Invoking New Relic security module') require 'newrelic_security' @agent_started = true else Agent.logger.info('New Relic Security is completely disabled by one of the user-provided configurations: `security.agent.enabled` or `high_security`. Not loading security capabilities.') Agent.logger.info("high_security = #{Agent.config[:high_security]}") Agent.logger.info("security.agent.enabled = #{Agent.config[:'security.agent.enabled']}") end rescue LoadError Agent.logger.info('New Relic security agent not found - skipping') rescue StandardError => exception Agent.logger.error("Exception in New Relic security module loading: #{exception} #{exception.backtrace}") end |
#record_supportability_metrics ⇒ Object
48 49 50 |
# File 'lib/new_relic/control/security_interface.rb', line 48 def record_supportability_metrics Agent.config[:'security.agent.enabled'] ? security_agent_metric(ENABLED) : security_agent_metric(DISABLED) end |
#security_agent_metric(setting) ⇒ Object
52 53 54 |
# File 'lib/new_relic/control/security_interface.rb', line 52 def security_agent_metric(setting) NewRelic::Agent.record_metric_once(SUPPORTABILITY_PREFIX_SECURITY_AGENT + setting) end |
#waiting? ⇒ Boolean
23 24 25 |
# File 'lib/new_relic/control/security_interface.rb', line 23 def waiting? (@wait ||= false) == true end |