Module: AsyncTaskOTELPatch

Defined in:
lib/stack-service-base/open_telemetry.rb

Instance Method Summary collapse

Instance Method Details

#initialize(parent = Task.current?, finished: nil, **options, &block) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/stack-service-base/open_telemetry.rb', line 28

def initialize(parent = Task.current?, finished: nil, **options, &block)
  ctx_ = OpenTelemetry::Context.current

  block_otl = ->(t, *arguments){
    OpenTelemetry::Context.with_current(ctx_) do
      block.call t, *arguments
    end
  }
  super parent, finished: , **options, &block_otl
end