Class: Contrast::Components::Agent::Interface
- Includes:
- ComponentBase, Interface
- Defined in:
- lib/contrast/components/agent.rb
Overview
A wrapper build around the Common Agent Configuration project to allow for access of the values contained in its parent_configuration_spec.yaml. Specifically, this allows for querying the state of the Agent.
Instance Method Summary collapse
- #disable! ⇒ Object
- #disabled? ⇒ Boolean
- #enable! ⇒ Object
- #enable_tracepoint ⇒ Object
- #enabled? ⇒ Boolean
- #exception_control ⇒ Object
- #insert_middleware(app) ⇒ Object
- #interpolation_enabled? ⇒ Boolean
- #omit_body? ⇒ Boolean
- #patch_interpolation? ⇒ Boolean
- #patch_yield? ⇒ Boolean
- #reset_ruleset ⇒ Object
- #rewrite_interpolation? ⇒ Boolean
- #ruleset ⇒ Object
- #skip_instrumentation?(loaded_module_name) ⇒ Boolean
Methods included from Interface
Methods included from ComponentBase
Instance Method Details
#disable! ⇒ Object
32 33 34 |
# File 'lib/contrast/components/agent.rb', line 32 def disable! @_enabled = false end |
#disabled? ⇒ Boolean
24 25 26 |
# File 'lib/contrast/components/agent.rb', line 24 def disabled? !enabled? end |
#enable! ⇒ Object
28 29 30 |
# File 'lib/contrast/components/agent.rb', line 28 def enable! @_enabled = true end |
#enable_tracepoint ⇒ Object
85 86 87 |
# File 'lib/contrast/components/agent.rb', line 85 def enable_tracepoint Contrast::Agent::TracePointHook.enable! end |
#enabled? ⇒ Boolean
19 20 21 22 |
# File 'lib/contrast/components/agent.rb', line 19 def enabled? @_enabled = !false?(CONFIG.root.enable) if @_enabled.nil? @_enabled end |
#exception_control ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/contrast/components/agent.rb', line 67 def exception_control @_exception_control ||= { enable: true?(CONFIG.root.agent.ruby.exceptions.capture), status: CONFIG.root.agent.ruby.exceptions.override_status || 403, message: CONFIG.root.agent.ruby.exceptions. || Contrast::Utils::ObjectShare::OVERRIDE_MESSAGE } end |
#insert_middleware(app) ⇒ Object
81 82 83 |
# File 'lib/contrast/components/agent.rb', line 81 def insert_middleware app app.middleware.insert_before 0, Contrast::Agent::Middleware # Keep our middleware at the outermost layer of the onion end |
#interpolation_enabled? ⇒ Boolean
57 58 59 60 |
# File 'lib/contrast/components/agent.rb', line 57 def interpolation_enabled? @_interpolation_enabled = !false?(CONFIG.root.agent.ruby.interpolate) if @_interpolation_enabled.nil? @_interpolation_enabled end |
#omit_body? ⇒ Boolean
62 63 64 65 |
# File 'lib/contrast/components/agent.rb', line 62 def omit_body? @_omit_body = true?(CONFIG.root.agent.omit_body) if @_omit_body.nil? @_omit_body end |
#patch_interpolation? ⇒ Boolean
44 45 46 |
# File 'lib/contrast/components/agent.rb', line 44 def patch_interpolation? interpolation_patch_possible? end |
#patch_yield? ⇒ Boolean
52 53 54 55 |
# File 'lib/contrast/components/agent.rb', line 52 def patch_yield? @_patch_yield = !false?(CONFIG.root.agent.ruby.propagate_yield) if @_patch_yield.nil? @_patch_yield end |
#reset_ruleset ⇒ Object
40 41 42 |
# File 'lib/contrast/components/agent.rb', line 40 def reset_ruleset @_ruleset = nil end |
#rewrite_interpolation? ⇒ Boolean
48 49 50 |
# File 'lib/contrast/components/agent.rb', line 48 def rewrite_interpolation? !interpolation_patch_possible? end |
#ruleset ⇒ Object
36 37 38 |
# File 'lib/contrast/components/agent.rb', line 36 def ruleset @_ruleset ||= Contrast::Agent::RuleSet.new(retrieve_ruleset&.values) end |
#skip_instrumentation?(loaded_module_name) ⇒ Boolean
75 76 77 78 79 |
# File 'lib/contrast/components/agent.rb', line 75 def skip_instrumentation? loaded_module_name return true unless loaded_module_name loaded_module_name.start_with?(*CONFIG.root.agent.ruby.uninstrument_namespace) end |