Class: Datadog::AppSec::Reactive::Operation
- Inherits:
-
Object
- Object
- Datadog::AppSec::Reactive::Operation
- Defined in:
- lib/datadog/appsec/reactive/operation.rb
Overview
Reactive Engine nested operation tracking
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#reactive ⇒ Object
readonly
Returns the value of attribute reactive.
Class Method Summary collapse
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize(name, parent = nil, reactive_engine = nil) ⇒ Operation
constructor
A new instance of Operation.
- #publish(address, data) ⇒ Object
-
#subscribe(*addresses, &block) ⇒ Object
TODO: use structs instead of an arg splat.
Constructor Details
#initialize(name, parent = nil, reactive_engine = nil) ⇒ Operation
Returns a new instance of Operation.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/datadog/appsec/reactive/operation.rb', line 14 def initialize(name, parent = nil, reactive_engine = nil) Datadog.logger.debug { "operation: #{name} initialize" } @name = name @parent = parent @reactive = select_reactive_engine(reactive_engine, parent) # TODO: concurrent store # TODO: constant Thread.current[:datadog_security_active_operation] = self yield self if block_given? ensure finalize end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/datadog/appsec/reactive/operation.rb', line 10 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
10 11 12 |
# File 'lib/datadog/appsec/reactive/operation.rb', line 10 def parent @parent end |
#reactive ⇒ Object (readonly)
Returns the value of attribute reactive.
10 11 12 |
# File 'lib/datadog/appsec/reactive/operation.rb', line 10 def reactive @reactive end |
Class Method Details
.active ⇒ Object
54 55 56 |
# File 'lib/datadog/appsec/reactive/operation.rb', line 54 def active Thread.current[:datadog_security_active_operation] end |
Instance Method Details
#finalize ⇒ Object
38 39 40 41 |
# File 'lib/datadog/appsec/reactive/operation.rb', line 38 def finalize Datadog.logger.debug { "operation: #{name} finalize" } Thread.current[:datadog_security_active_operation] = parent end |
#publish(address, data) ⇒ Object
34 35 36 |
# File 'lib/datadog/appsec/reactive/operation.rb', line 34 def publish(address, data) reactive.publish(address, data) end |
#subscribe(*addresses, &block) ⇒ Object
TODO: use structs instead of an arg splat
30 31 32 |
# File 'lib/datadog/appsec/reactive/operation.rb', line 30 def subscribe(*addresses, &block) reactive.subscribe(*addresses, &block) end |