Module: Atatus::GraphQL Private

Defined in:
lib/atatus/graphql.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary collapse

TYPE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'app'
SUBTYPE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'graphql'
PREFIX =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'GraphQL: '
UNNAMED =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'[unnamed]'
MULTIPLE_QUERIES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'[multiple-queries]'
CONCATENATOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'+'
MAX_NUMBER_OF_QUERIES_FOR_NAME =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

5
KEYS_TO_NAME =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  'lex' => 'graphql.lex',
  'parse' => 'graphql.parse',
  'validate' => 'graphql.validate',
  'analyze_multiplex' => 'graphql.analyze_multiplex',
  'analyze_query' => 'graphql.analyze_query',
  'execute_multiplex' => 'graphql.execute_multiplex',
  'execute_query' => 'graphql.execute_query',
  'execute_query_lazy' => 'graphql.execute_query_lazy',
  'authorized_lazy' => 'graphql.authorized_lazy',
  'resolve_type' => 'graphql.resolve_type',
  'resolve_type_lazy' => 'graphql.resolve_type_lazy'

  # These are available but deliberately left out as they are mostly noise.
  # "execute_field" => "graphql.execute_field",
  # "execute_field_lazy" => "graphql.execute_field_lazy",
  # "authorized" => "graphql.authorized",
}.freeze

Class Method Summary collapse

Class Method Details

.trace(key, data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/atatus/graphql.rb', line 51

def self.trace(key, data)
  return yield unless KEYS_TO_NAME.key?(key)
  return yield unless (transaction = Atatus.current_transaction)

  if key == 'execute_query'
    transaction.name =
      "#{PREFIX}#{query_name(data[:query])}"
  end

  results =
    Atatus.with_span(
      KEYS_TO_NAME.fetch(key, key),
      TYPE, subtype: SUBTYPE, action: key
    ) { yield }

  if key == 'execute_multiplex'
    transaction.name = "#{PREFIX}#{concat_names(results)}"
  end

  results
end