Method: GraphQL::Tracing::NotificationsTracing#trace
- Defined in:
- lib/graphql/tracing/notifications_tracing.rb
permalink #trace(key, metadata) { ... } ⇒ Object
Sends a GraphQL tracing event to the notification handler
. notifications_engine = Dry::Monitor::Notifications.new(:graphql) . tracer = GraphQL::Tracing::NotificationsTracing.new(notifications_engine) . tracer.trace("lex") { ... }
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/graphql/tracing/notifications_tracing.rb', line 49 def trace(key, , &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, , &blk) end |