class GraphQL::Tracing::NotificationsTracing
@see KEYS for event names
with a ‘graphql` suffix.
ActiveSupport::Notifications or Dry::Monitor::Notifications)
This implementation forwards events to a notification handler (i.e.
def initialize(notifications_engine)
-
notifications_engine
(Object
) -- The notifications engine to use
def initialize(notifications_engine) @notifications_engine = notifications_engine end
def trace(key, metadata, &blk)
- Yield: - The block to execute for the event
Parameters:
-
metadata
(Hash
) -- The metadata for the event -
key
(string
) -- The key for the event
def trace(key, metadata, &blk) prefixed_key = KEYS[key] || "#{key}.graphql" # Cache the new keys while making sure not to induce a memory leak if KEYS.size < MAX_KEYS_SIZE KEYS[key] ||= prefixed_key end @notifications_engine.instrument(prefixed_key, metadata, &blk) end