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.

Constant Summary collapse

KEYS =

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

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

Class Method Summary collapse

Class Method Details

.trace(key, metadata) ⇒ Object



26
27
28
29
30
31
# File 'lib/graphql/tracing/active_support_notifications_tracing.rb', line 26

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