Sha256: 577d6af5a74fb7915f76e9eaf551aab07d30fcfbf5fd6a4335a0b1e01cf9e901
Contents?: true
Size: 1.27 KB
Versions: 11
Compression:
Stored size: 1.27 KB
Contents
# typed: true require_relative 'engine' module Datadog module AppSec module Reactive # Reactive Engine nested operation tracking class Operation attr_reader :reactive, :parent, :name def initialize(name, parent = nil, reactive_engine = nil) Datadog.logger.debug { "operation: #{name} initialize" } @name = name @parent = parent @reactive = reactive_engine || parent && parent.reactive || Reactive::Engine.new # TODO: concurrent store # TODO: constant Thread.current[:datadog_security_active_operation] = self yield self if block_given? ensure finalize end # TODO: use structs instead of an arg splat def subscribe(*addresses, &block) reactive.subscribe(*addresses, &block) end def publish(address, data) reactive.publish(address, data) end def finalize Datadog.logger.debug { "operation: #{name} finalize" } Thread.current[:datadog_security_active_operation] = parent end class << self def active Thread.current[:datadog_security_active_operation] end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems