Method: GraphQL::Tracing::NotificationsTrace#initialize

Defined in:
lib/graphql/tracing/notifications_trace.rb

#initialize(engine:, **rest) ⇒ Object

Parameters:

  • engine (Class)

    The notifications engine to use, eg Dry::Monitor or ActiveSupport::Notifications



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/graphql/tracing/notifications_trace.rb', line 77

def initialize(engine:, **rest)
  adapter = if defined?(Dry::Monitor) && engine == Dry::Monitor
    DryMonitoringAdapter
  elsif defined?(ActiveSupport::Notifications) && engine == ActiveSupport::Notifications
    ActiveSupportNotificationsAdapter
  else
    engine
  end
  @notifications = adapter.new
  super
end