lib/opentelemetry/instrumentation/action_view/fanout.rb in opentelemetry-instrumentation-action_view-0.1.0 vs lib/opentelemetry/instrumentation/action_view/fanout.rb in opentelemetry-instrumentation-action_view-0.1.1

- old
+ new

@@ -1,17 +1,23 @@ # frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 +# +require 'delegate' module OpenTelemetry module Instrumentation module ActionView # This is a replacement for the default Fanout notifications queue, which adds special # handling around returned context from the SpanSubscriber notification handlers. # Used together, it allows us to trace arbitrary ActiveSupport::Notifications safely. - class Fanout < ::ActiveSupport::Notifications::Fanout + class Fanout < DelegateClass(::ActiveSupport::Notifications::Fanout) + def initialize(notifier = ::ActiveSupport::Notifications::Fanout.new) + super(notifier) + end + def start(name, id, payload) listeners_for(name).map do |s| result = [s] state = s.start(name, id, payload) if state.is_a?(Array) && state[0].is_a?(OpenTelemetry::Trace::Span) && state[1] # rubocop:disable Style/IfUnlessModifier