Module: GraphQL::Tracing::ActiveSupportNotificationsTracing

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

Overview

This implementation forwards events to ActiveSupport::Notifications with a graphql. prefix.

Installed automatically when ActiveSupport::Notifications is discovered.

Constant Summary

KEYS =

A cache of frequently-used keys to avoid needless string allocations

{
  "lex" => "graphql.lex",
  "parse" => "graphql.parse",
  "validate" => "graphql.validate",
  "analyze_multiplex" => "graphql.analyze_multiplex",
  "analyze_query" => "graphql.analyze_query",
  "execute_query" => "graphql.execute_query",
  "execute_query_lazy" => "graphql.execute_query_lazy",
  "execute_field" => "graphql.execute_field",
  "execute_field_lazy" => "graphql.execute_field_lazy",
}

Class Method Summary collapse

Class Method Details

.trace(key, metadata) ⇒ Object



23
24
25
26
27
28
# File 'lib/graphql/tracing/active_support_notifications_tracing.rb', line 23

def self.trace(key, )
  prefixed_key = KEYS[key] || "graphql.#{key}"
  ActiveSupport::Notifications.instrument(prefixed_key, ) do
    yield
  end
end