graphql 2.4.7 → 2.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of graphql might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/lib/graphql/backtrace/table.rb +95 -55
 - data/lib/graphql/backtrace.rb +1 -19
 - data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +11 -4
 - data/lib/graphql/execution/interpreter/runtime.rb +34 -26
 - data/lib/graphql/execution/interpreter.rb +3 -1
 - data/lib/graphql/execution/multiplex.rb +0 -4
 - data/lib/graphql/introspection/directive_location_enum.rb +1 -1
 - data/lib/graphql/query.rb +0 -8
 - data/lib/graphql/schema/build_from_definition.rb +1 -0
 - data/lib/graphql/schema/enum.rb +21 -1
 - data/lib/graphql/schema/resolver.rb +1 -0
 - data/lib/graphql/schema/subscription.rb +50 -4
 - data/lib/graphql/schema/validator/required_validator.rb +23 -6
 - data/lib/graphql/schema/visibility/profile.rb +1 -1
 - data/lib/graphql/schema.rb +8 -24
 - data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +12 -10
 - data/lib/graphql/subscriptions/event.rb +12 -1
 - data/lib/graphql/subscriptions/serialize.rb +1 -3
 - data/lib/graphql/tracing/active_support_notifications_trace.rb +1 -1
 - data/lib/graphql/tracing/active_support_notifications_tracing.rb +1 -1
 - data/lib/graphql/tracing/appoptics_trace.rb +2 -0
 - data/lib/graphql/tracing/appoptics_tracing.rb +2 -0
 - data/lib/graphql/tracing/appsignal_trace.rb +2 -0
 - data/lib/graphql/tracing/appsignal_tracing.rb +2 -0
 - data/lib/graphql/tracing/call_legacy_tracers.rb +66 -0
 - data/lib/graphql/tracing/data_dog_trace.rb +2 -0
 - data/lib/graphql/tracing/data_dog_tracing.rb +2 -0
 - data/lib/graphql/tracing/legacy_hooks_trace.rb +1 -0
 - data/lib/graphql/tracing/legacy_trace.rb +4 -61
 - data/lib/graphql/tracing/new_relic_trace.rb +2 -0
 - data/lib/graphql/tracing/new_relic_tracing.rb +2 -0
 - data/lib/graphql/tracing/notifications_tracing.rb +2 -0
 - data/lib/graphql/tracing/null_trace.rb +9 -0
 - data/lib/graphql/tracing/prometheus_trace/graphql_collector.rb +2 -0
 - data/lib/graphql/tracing/prometheus_trace.rb +5 -0
 - data/lib/graphql/tracing/prometheus_tracing.rb +2 -0
 - data/lib/graphql/tracing/scout_trace.rb +2 -0
 - data/lib/graphql/tracing/scout_tracing.rb +2 -0
 - data/lib/graphql/tracing/sentry_trace.rb +2 -0
 - data/lib/graphql/tracing/statsd_trace.rb +2 -0
 - data/lib/graphql/tracing/statsd_tracing.rb +2 -0
 - data/lib/graphql/tracing/trace.rb +4 -1
 - data/lib/graphql/tracing.rb +28 -30
 - data/lib/graphql/version.rb +1 -1
 - metadata +103 -9
 - data/lib/graphql/backtrace/inspect_result.rb +0 -38
 - data/lib/graphql/backtrace/trace.rb +0 -93
 - data/lib/graphql/backtrace/tracer.rb +0 -80
 
    
        data/lib/graphql/schema.rb
    CHANGED
    
    | 
         @@ -167,9 +167,6 @@ module GraphQL 
     | 
|
| 
       167 
167 
     | 
    
         
             
                      mods.each { |mod| new_class.include(mod) }
         
     | 
| 
       168 
168 
     | 
    
         
             
                      new_class.include(DefaultTraceClass)
         
     | 
| 
       169 
169 
     | 
    
         
             
                      trace_mode(:default, new_class)
         
     | 
| 
       170 
     | 
    
         
            -
                      backtrace_class = Class.new(new_class)
         
     | 
| 
       171 
     | 
    
         
            -
                      backtrace_class.include(GraphQL::Backtrace::Trace)
         
     | 
| 
       172 
     | 
    
         
            -
                      trace_mode(:default_backtrace, backtrace_class)
         
     | 
| 
       173 
170 
     | 
    
         
             
                    end
         
     | 
| 
       174 
171 
     | 
    
         
             
                    trace_class_for(:default, build: true)
         
     | 
| 
       175 
172 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -216,11 +213,6 @@ module GraphQL 
     | 
|
| 
       216 
213 
     | 
    
         
             
                      const_set(:DefaultTrace, Class.new(base_class) do
         
     | 
| 
       217 
214 
     | 
    
         
             
                        include DefaultTraceClass
         
     | 
| 
       218 
215 
     | 
    
         
             
                      end)
         
     | 
| 
       219 
     | 
    
         
            -
                    when :default_backtrace
         
     | 
| 
       220 
     | 
    
         
            -
                      schema_base_class = trace_class_for(:default, build: true)
         
     | 
| 
       221 
     | 
    
         
            -
                      const_set(:DefaultTraceBacktrace, Class.new(schema_base_class) do
         
     | 
| 
       222 
     | 
    
         
            -
                        include(GraphQL::Backtrace::Trace)
         
     | 
| 
       223 
     | 
    
         
            -
                      end)
         
     | 
| 
       224 
216 
     | 
    
         
             
                    else
         
     | 
| 
       225 
217 
     | 
    
         
             
                      # First, see if the superclass has a custom-defined class for this.
         
     | 
| 
       226 
218 
     | 
    
         
             
                      # Then, if it doesn't, use this class's default trace
         
     | 
| 
         @@ -1118,8 +1110,14 @@ module GraphQL 
     | 
|
| 
       1118 
1110 
     | 
    
         
             
                    }
         
     | 
| 
       1119 
1111 
     | 
    
         
             
                  end
         
     | 
| 
       1120 
1112 
     | 
    
         | 
| 
      
 1113 
     | 
    
         
            +
                  # @api private
         
     | 
| 
      
 1114 
     | 
    
         
            +
                  attr_accessor :using_backtrace
         
     | 
| 
      
 1115 
     | 
    
         
            +
             
     | 
| 
       1121 
1116 
     | 
    
         
             
                  # @api private
         
     | 
| 
       1122 
1117 
     | 
    
         
             
                  def handle_or_reraise(context, err)
         
     | 
| 
      
 1118 
     | 
    
         
            +
                    if context[:backtrace] || using_backtrace
         
     | 
| 
      
 1119 
     | 
    
         
            +
                      err = GraphQL::Backtrace::TracedError.new(err, context)
         
     | 
| 
      
 1120 
     | 
    
         
            +
                    end
         
     | 
| 
       1123 
1121 
     | 
    
         
             
                    handler = Execution::Errors.find_handler_for(self, err.class)
         
     | 
| 
       1124 
1122 
     | 
    
         
             
                    if handler
         
     | 
| 
       1125 
1123 
     | 
    
         
             
                      obj = context[:current_object]
         
     | 
| 
         @@ -1449,22 +1447,8 @@ module GraphQL 
     | 
|
| 
       1449 
1447 
     | 
    
         
             
                    target = options[:query] || options[:multiplex]
         
     | 
| 
       1450 
1448 
     | 
    
         
             
                    mode ||= target && target.context[:trace_mode]
         
     | 
| 
       1451 
1449 
     | 
    
         | 
| 
       1452 
     | 
    
         
            -
                    trace_mode =  
     | 
| 
       1453 
     | 
    
         
            -
             
     | 
| 
       1454 
     | 
    
         
            -
                    elsif target && target.context[:backtrace]
         
     | 
| 
       1455 
     | 
    
         
            -
                      if default_trace_mode != :default
         
     | 
| 
       1456 
     | 
    
         
            -
                        raise ArgumentError, "Can't use `context[:backtrace]` with a custom default trace mode (`#{dm.inspect}`)"
         
     | 
| 
       1457 
     | 
    
         
            -
                      else
         
     | 
| 
       1458 
     | 
    
         
            -
                        own_trace_modes[:default_backtrace] ||= build_trace_mode(:default_backtrace)
         
     | 
| 
       1459 
     | 
    
         
            -
                        options_trace_mode = :default
         
     | 
| 
       1460 
     | 
    
         
            -
                        :default_backtrace
         
     | 
| 
       1461 
     | 
    
         
            -
                      end
         
     | 
| 
       1462 
     | 
    
         
            -
                    else
         
     | 
| 
       1463 
     | 
    
         
            -
                      default_trace_mode
         
     | 
| 
       1464 
     | 
    
         
            -
                    end
         
     | 
| 
       1465 
     | 
    
         
            -
             
     | 
| 
       1466 
     | 
    
         
            -
                    options_trace_mode ||= trace_mode
         
     | 
| 
       1467 
     | 
    
         
            -
                    base_trace_options = trace_options_for(options_trace_mode)
         
     | 
| 
      
 1450 
     | 
    
         
            +
                    trace_mode = mode || default_trace_mode
         
     | 
| 
      
 1451 
     | 
    
         
            +
                    base_trace_options = trace_options_for(trace_mode)
         
     | 
| 
       1468 
1452 
     | 
    
         
             
                    trace_options = base_trace_options.merge(options)
         
     | 
| 
       1469 
1453 
     | 
    
         
             
                    trace_class_for_mode = trace_class_for(trace_mode, build: true)
         
     | 
| 
       1470 
1454 
     | 
    
         
             
                    trace_class_for_mode.new(**trace_options)
         
     | 
| 
         @@ -20,12 +20,22 @@ module GraphQL 
     | 
|
| 
       20 
20 
     | 
    
         
             
                  def after_resolve(value:, context:, object:, arguments:, **rest)
         
     | 
| 
       21 
21 
     | 
    
         
             
                    if value.is_a?(GraphQL::ExecutionError)
         
     | 
| 
       22 
22 
     | 
    
         
             
                      value
         
     | 
| 
      
 23 
     | 
    
         
            +
                    elsif @field.resolver&.method_defined?(:subscription_written?) &&
         
     | 
| 
      
 24 
     | 
    
         
            +
                      (subscription_namespace = context.namespace(:subscriptions)) &&
         
     | 
| 
      
 25 
     | 
    
         
            +
                      (subscriptions_by_path = subscription_namespace[:subscriptions])
         
     | 
| 
      
 26 
     | 
    
         
            +
                      (subscription_instance = subscriptions_by_path[context.current_path])
         
     | 
| 
      
 27 
     | 
    
         
            +
                      # If it was already written, don't append this event to be written later
         
     | 
| 
      
 28 
     | 
    
         
            +
                      if !subscription_instance.subscription_written?
         
     | 
| 
      
 29 
     | 
    
         
            +
                        events = context.namespace(:subscriptions)[:events]
         
     | 
| 
      
 30 
     | 
    
         
            +
                        events << subscription_instance.event
         
     | 
| 
      
 31 
     | 
    
         
            +
                      end
         
     | 
| 
      
 32 
     | 
    
         
            +
                      value
         
     | 
| 
       23 
33 
     | 
    
         
             
                    elsif (events = context.namespace(:subscriptions)[:events])
         
     | 
| 
       24 
34 
     | 
    
         
             
                      # This is the first execution, so gather an Event
         
     | 
| 
       25 
35 
     | 
    
         
             
                      # for the backend to register:
         
     | 
| 
       26 
36 
     | 
    
         
             
                      event = Subscriptions::Event.new(
         
     | 
| 
       27 
37 
     | 
    
         
             
                        name: field.name,
         
     | 
| 
       28 
     | 
    
         
            -
                        arguments:  
     | 
| 
      
 38 
     | 
    
         
            +
                        arguments: arguments,
         
     | 
| 
       29 
39 
     | 
    
         
             
                        context: context,
         
     | 
| 
       30 
40 
     | 
    
         
             
                        field: field,
         
     | 
| 
       31 
41 
     | 
    
         
             
                      )
         
     | 
| 
         @@ -33,7 +43,7 @@ module GraphQL 
     | 
|
| 
       33 
43 
     | 
    
         
             
                      value
         
     | 
| 
       34 
44 
     | 
    
         
             
                    elsif context.query.subscription_topic == Subscriptions::Event.serialize(
         
     | 
| 
       35 
45 
     | 
    
         
             
                        field.name,
         
     | 
| 
       36 
     | 
    
         
            -
                         
     | 
| 
      
 46 
     | 
    
         
            +
                        arguments,
         
     | 
| 
       37 
47 
     | 
    
         
             
                        field,
         
     | 
| 
       38 
48 
     | 
    
         
             
                        scope: (field.subscription_scope ? context[field.subscription_scope] : nil),
         
     | 
| 
       39 
49 
     | 
    
         
             
                      )
         
     | 
| 
         @@ -45,14 +55,6 @@ module GraphQL 
     | 
|
| 
       45 
55 
     | 
    
         
             
                      context.skip
         
     | 
| 
       46 
56 
     | 
    
         
             
                    end
         
     | 
| 
       47 
57 
     | 
    
         
             
                  end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                  private
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                  def arguments_without_field_extras(arguments:)
         
     | 
| 
       52 
     | 
    
         
            -
                    arguments.dup.tap do |event_args|
         
     | 
| 
       53 
     | 
    
         
            -
                      field.extras.each { |k| event_args.delete(k) }
         
     | 
| 
       54 
     | 
    
         
            -
                    end
         
     | 
| 
       55 
     | 
    
         
            -
                  end
         
     | 
| 
       56 
58 
     | 
    
         
             
                end
         
     | 
| 
       57 
59 
     | 
    
         
             
              end
         
     | 
| 
       58 
60 
     | 
    
         
             
            end
         
     | 
| 
         @@ -20,7 +20,7 @@ module GraphQL 
     | 
|
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  def initialize(name:, arguments:, field: nil, context: nil, scope: nil)
         
     | 
| 
       22 
22 
     | 
    
         
             
                    @name = name
         
     | 
| 
       23 
     | 
    
         
            -
                    @arguments = arguments
         
     | 
| 
      
 23 
     | 
    
         
            +
                    @arguments = self.class.arguments_without_field_extras(arguments: arguments, field: field)
         
     | 
| 
       24 
24 
     | 
    
         
             
                    @context = context
         
     | 
| 
       25 
25 
     | 
    
         
             
                    field ||= context.field
         
     | 
| 
       26 
26 
     | 
    
         
             
                    scope_key = field.subscription_scope
         
     | 
| 
         @@ -39,6 +39,7 @@ module GraphQL 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  # @return [String] an identifier for this unit of subscription
         
     | 
| 
       40 
40 
     | 
    
         
             
                  def self.serialize(_name, arguments, field, scope:, context: GraphQL::Query::NullContext.instance)
         
     | 
| 
       41 
41 
     | 
    
         
             
                    subscription = field.resolver || GraphQL::Schema::Subscription
         
     | 
| 
      
 42 
     | 
    
         
            +
                    arguments = arguments_without_field_extras(field: field, arguments: arguments)
         
     | 
| 
       42 
43 
     | 
    
         
             
                    normalized_args = stringify_args(field, arguments.to_h, context)
         
     | 
| 
       43 
44 
     | 
    
         
             
                    subscription.topic_for(arguments: normalized_args, field: field, scope: scope)
         
     | 
| 
       44 
45 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -60,6 +61,16 @@ module GraphQL 
     | 
|
| 
       60 
61 
     | 
    
         
             
                  end
         
     | 
| 
       61 
62 
     | 
    
         | 
| 
       62 
63 
     | 
    
         
             
                  class << self
         
     | 
| 
      
 64 
     | 
    
         
            +
                    def arguments_without_field_extras(arguments:, field:)
         
     | 
| 
      
 65 
     | 
    
         
            +
                      if !field.extras.empty?
         
     | 
| 
      
 66 
     | 
    
         
            +
                        arguments = arguments.dup
         
     | 
| 
      
 67 
     | 
    
         
            +
                        field.extras.each do |extra_key|
         
     | 
| 
      
 68 
     | 
    
         
            +
                          arguments.delete(extra_key)
         
     | 
| 
      
 69 
     | 
    
         
            +
                        end
         
     | 
| 
      
 70 
     | 
    
         
            +
                      end
         
     | 
| 
      
 71 
     | 
    
         
            +
                      arguments
         
     | 
| 
      
 72 
     | 
    
         
            +
                    end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
       63 
74 
     | 
    
         
             
                    private
         
     | 
| 
       64 
75 
     | 
    
         | 
| 
       65 
76 
     | 
    
         
             
                    # This method does not support cyclic references in the Hash,
         
     | 
| 
         @@ -1,7 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         
             
            require "set"
         
     | 
| 
       3 
     | 
    
         
            -
            require "ostruct"
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
3 
     | 
    
         
             
            module GraphQL
         
     | 
| 
       6 
4 
     | 
    
         
             
              class Subscriptions
         
     | 
| 
       7 
5 
     | 
    
         
             
                # Serialization helpers for passing subscription data around.
         
     | 
| 
         @@ -148,7 +146,7 @@ module GraphQL 
     | 
|
| 
       148 
146 
     | 
    
         
             
                      elsif obj.is_a?(Date) || obj.is_a?(Time)
         
     | 
| 
       149 
147 
     | 
    
         
             
                        # DateTime extends Date; for TimeWithZone, call `.utc` first.
         
     | 
| 
       150 
148 
     | 
    
         
             
                        { TIMESTAMP_KEY => [obj.class.name, obj.strftime(TIMESTAMP_FORMAT)] }
         
     | 
| 
       151 
     | 
    
         
            -
                      elsif obj.is_a?(OpenStruct)
         
     | 
| 
      
 149 
     | 
    
         
            +
                      elsif defined?(OpenStruct) && obj.is_a?(OpenStruct)
         
     | 
| 
       152 
150 
     | 
    
         
             
                        { OPEN_STRUCT_KEY => dump_value(obj.to_h) }
         
     | 
| 
       153 
151 
     | 
    
         
             
                      elsif defined?(ActiveRecord::Relation) && obj.is_a?(ActiveRecord::Relation)
         
     | 
| 
       154 
152 
     | 
    
         
             
                        dump_value(obj.to_a)
         
     | 
| 
         @@ -0,0 +1,66 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module GraphQL
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Tracing
         
     | 
| 
      
 5 
     | 
    
         
            +
                # This trace class calls legacy-style tracer with payload hashes.
         
     | 
| 
      
 6 
     | 
    
         
            +
                # New-style `trace_with` modules significantly reduce the overhead of tracing,
         
     | 
| 
      
 7 
     | 
    
         
            +
                # but that advantage is lost when legacy-style tracers are also used (since the payload hashes are still constructed).
         
     | 
| 
      
 8 
     | 
    
         
            +
                module CallLegacyTracers
         
     | 
| 
      
 9 
     | 
    
         
            +
                  def lex(query_string:)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    (@multiplex || @query).trace("lex", { query_string: query_string }) { super }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  def parse(query_string:)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    (@multiplex || @query).trace("parse", { query_string: query_string }) { super }
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def validate(query:, validate:)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    query.trace("validate", { validate: validate, query: query }) { super }
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  def analyze_multiplex(multiplex:)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    multiplex.trace("analyze_multiplex", { multiplex: multiplex }) { super }
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  def analyze_query(query:)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    query.trace("analyze_query", { query: query }) { super }
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  def execute_multiplex(multiplex:)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    multiplex.trace("execute_multiplex", { multiplex: multiplex }) { super }
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def execute_query(query:)
         
     | 
| 
      
 34 
     | 
    
         
            +
                    query.trace("execute_query", { query: query }) { super }
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  def execute_query_lazy(query:, multiplex:)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    multiplex.trace("execute_query_lazy", { multiplex: multiplex, query: query }) { super }
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  def execute_field(field:, query:, ast_node:, arguments:, object:)
         
     | 
| 
      
 42 
     | 
    
         
            +
                    query.trace("execute_field", { field: field, query: query, ast_node: ast_node, arguments: arguments, object: object, owner: field.owner, path: query.context[:current_path] }) { super }
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  def execute_field_lazy(field:, query:, ast_node:, arguments:, object:)
         
     | 
| 
      
 46 
     | 
    
         
            +
                    query.trace("execute_field_lazy", { field: field, query: query, ast_node: ast_node, arguments: arguments, object: object, owner: field.owner, path: query.context[:current_path] }) { super }
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def authorized(query:, type:, object:)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    query.trace("authorized", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  def authorized_lazy(query:, type:, object:)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    query.trace("authorized_lazy", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  def resolve_type(query:, type:, object:)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    query.trace("resolve_type", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                  def resolve_type_lazy(query:, type:, object:)
         
     | 
| 
      
 62 
     | 
    
         
            +
                    query.trace("resolve_type_lazy", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
              end
         
     | 
| 
      
 66 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,67 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            module GraphQL
         
     | 
| 
       3 
     | 
    
         
            -
              module Tracing
         
     | 
| 
       4 
     | 
    
         
            -
                # This trace class calls legacy-style tracer with payload hashes.
         
     | 
| 
       5 
     | 
    
         
            -
                # New-style `trace_with` modules significantly reduce the overhead of tracing,
         
     | 
| 
       6 
     | 
    
         
            -
                # but that advantage is lost when legacy-style tracers are also used (since the payload hashes are still constructed).
         
     | 
| 
       7 
     | 
    
         
            -
                module CallLegacyTracers
         
     | 
| 
       8 
     | 
    
         
            -
                  def lex(query_string:)
         
     | 
| 
       9 
     | 
    
         
            -
                    (@multiplex || @query).trace("lex", { query_string: query_string }) { super }
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                  def parse(query_string:)
         
     | 
| 
       13 
     | 
    
         
            -
                    (@multiplex || @query).trace("parse", { query_string: query_string }) { super }
         
     | 
| 
       14 
     | 
    
         
            -
                  end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                  def validate(query:, validate:)
         
     | 
| 
       17 
     | 
    
         
            -
                    query.trace("validate", { validate: validate, query: query }) { super }
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                  def analyze_multiplex(multiplex:)
         
     | 
| 
       21 
     | 
    
         
            -
                    multiplex.trace("analyze_multiplex", { multiplex: multiplex }) { super }
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  def analyze_query(query:)
         
     | 
| 
       25 
     | 
    
         
            -
                    query.trace("analyze_query", { query: query }) { super }
         
     | 
| 
       26 
     | 
    
         
            -
                  end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                  def execute_multiplex(multiplex:)
         
     | 
| 
       29 
     | 
    
         
            -
                    multiplex.trace("execute_multiplex", { multiplex: multiplex }) { super }
         
     | 
| 
       30 
     | 
    
         
            -
                  end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                  def execute_query(query:)
         
     | 
| 
       33 
     | 
    
         
            -
                    query.trace("execute_query", { query: query }) { super }
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                  def execute_query_lazy(query:, multiplex:)
         
     | 
| 
       37 
     | 
    
         
            -
                    multiplex.trace("execute_query_lazy", { multiplex: multiplex, query: query }) { super }
         
     | 
| 
       38 
     | 
    
         
            -
                  end
         
     | 
| 
       39 
2 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                  def execute_field_lazy(field:, query:, ast_node:, arguments:, object:)
         
     | 
| 
       45 
     | 
    
         
            -
                    query.trace("execute_field_lazy", { field: field, query: query, ast_node: ast_node, arguments: arguments, object: object, owner: field.owner, path: query.context[:current_path] }) { super }
         
     | 
| 
       46 
     | 
    
         
            -
                  end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                  def authorized(query:, type:, object:)
         
     | 
| 
       49 
     | 
    
         
            -
                    query.trace("authorized", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
         
     | 
| 
       50 
     | 
    
         
            -
                  end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                  def authorized_lazy(query:, type:, object:)
         
     | 
| 
       53 
     | 
    
         
            -
                    query.trace("authorized_lazy", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
         
     | 
| 
       54 
     | 
    
         
            -
                  end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                  def resolve_type(query:, type:, object:)
         
     | 
| 
       57 
     | 
    
         
            -
                    query.trace("resolve_type", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
         
     | 
| 
       58 
     | 
    
         
            -
                  end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  def resolve_type_lazy(query:, type:, object:)
         
     | 
| 
       61 
     | 
    
         
            -
                    query.trace("resolve_type_lazy", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
         
     | 
| 
       62 
     | 
    
         
            -
                  end
         
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "graphql/tracing/trace"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "graphql/tracing/call_legacy_tracers"
         
     | 
| 
       64 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
            module GraphQL
         
     | 
| 
      
 7 
     | 
    
         
            +
              module Tracing
         
     | 
| 
       65 
8 
     | 
    
         
             
                class LegacyTrace < Trace
         
     | 
| 
       66 
9 
     | 
    
         
             
                  include CallLegacyTracers
         
     | 
| 
       67 
10 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,8 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require "graphql/tracing/platform_trace"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       3 
5 
     | 
    
         
             
            module GraphQL
         
     | 
| 
       4 
6 
     | 
    
         
             
              module Tracing
         
     | 
| 
       5 
7 
     | 
    
         
             
                module PrometheusTrace
         
     | 
| 
      
 8 
     | 
    
         
            +
                  if defined?(PrometheusExporter::Server)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    autoload :GraphQLCollector, "graphql/tracing/prometheus_trace/graphql_collector"
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
       6 
11 
     | 
    
         
             
                  include PlatformTrace
         
     | 
| 
       7 
12 
     | 
    
         | 
| 
       8 
13 
     | 
    
         
             
                  def initialize(client: PrometheusExporter::Client.default, keys_whitelist: ["execute_field", "execute_field_lazy"], collector_type: "graphql", **rest)
         
     | 
| 
         @@ -1,11 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "graphql/tracing"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       2 
5 
     | 
    
         
             
            module GraphQL
         
     | 
| 
       3 
6 
     | 
    
         
             
              module Tracing
         
     | 
| 
       4 
7 
     | 
    
         
             
                # This is the base class for a `trace` instance whose methods are called during query execution.
         
     | 
| 
       5 
8 
     | 
    
         
             
                # "Trace modes" are subclasses of this with custom tracing modules mixed in.
         
     | 
| 
       6 
9 
     | 
    
         
             
                #
         
     | 
| 
       7 
10 
     | 
    
         
             
                # A trace module may implement any of the methods on `Trace`, being sure to call `super`
         
     | 
| 
       8 
     | 
    
         
            -
                # to continue any tracing hooks and call the actual runtime behavior. 
     | 
| 
      
 11 
     | 
    
         
            +
                # to continue any tracing hooks and call the actual runtime behavior.
         
     | 
| 
       9 
12 
     | 
    
         
             
                #
         
     | 
| 
       10 
13 
     | 
    
         
             
                class Trace
         
     | 
| 
       11 
14 
     | 
    
         
             
                  # @param multiplex [GraphQL::Execution::Multiplex, nil]
         
     | 
    
        data/lib/graphql/tracing.rb
    CHANGED
    
    | 
         @@ -1,38 +1,36 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            require "graphql/tracing/trace"
         
     | 
| 
       3 
     | 
    
         
            -
            require "graphql/tracing/legacy_trace"
         
     | 
| 
       4 
     | 
    
         
            -
            require "graphql/tracing/legacy_hooks_trace"
         
     | 
| 
       5 
2 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            # Legacy tracing:
         
     | 
| 
       7 
     | 
    
         
            -
            require "graphql/tracing/active_support_notifications_tracing"
         
     | 
| 
       8 
     | 
    
         
            -
            require "graphql/tracing/platform_tracing"
         
     | 
| 
       9 
     | 
    
         
            -
            require "graphql/tracing/appoptics_tracing"
         
     | 
| 
       10 
     | 
    
         
            -
            require "graphql/tracing/appsignal_tracing"
         
     | 
| 
       11 
     | 
    
         
            -
            require "graphql/tracing/data_dog_tracing"
         
     | 
| 
       12 
     | 
    
         
            -
            require "graphql/tracing/new_relic_tracing"
         
     | 
| 
       13 
     | 
    
         
            -
            require "graphql/tracing/scout_tracing"
         
     | 
| 
       14 
     | 
    
         
            -
            require "graphql/tracing/statsd_tracing"
         
     | 
| 
       15 
     | 
    
         
            -
            require "graphql/tracing/prometheus_tracing"
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            # New Tracing:
         
     | 
| 
       18 
     | 
    
         
            -
            require "graphql/tracing/active_support_notifications_trace"
         
     | 
| 
       19 
     | 
    
         
            -
            require "graphql/tracing/platform_trace"
         
     | 
| 
       20 
     | 
    
         
            -
            require "graphql/tracing/appoptics_trace"
         
     | 
| 
       21 
     | 
    
         
            -
            require "graphql/tracing/appsignal_trace"
         
     | 
| 
       22 
     | 
    
         
            -
            require "graphql/tracing/data_dog_trace"
         
     | 
| 
       23 
     | 
    
         
            -
            require "graphql/tracing/new_relic_trace"
         
     | 
| 
       24 
     | 
    
         
            -
            require "graphql/tracing/notifications_trace"
         
     | 
| 
       25 
     | 
    
         
            -
            require "graphql/tracing/sentry_trace"
         
     | 
| 
       26 
     | 
    
         
            -
            require "graphql/tracing/scout_trace"
         
     | 
| 
       27 
     | 
    
         
            -
            require "graphql/tracing/statsd_trace"
         
     | 
| 
       28 
     | 
    
         
            -
            require "graphql/tracing/prometheus_trace"
         
     | 
| 
       29 
     | 
    
         
            -
            if defined?(PrometheusExporter::Server)
         
     | 
| 
       30 
     | 
    
         
            -
              require "graphql/tracing/prometheus_trace/graphql_collector"
         
     | 
| 
       31 
     | 
    
         
            -
            end
         
     | 
| 
       32 
3 
     | 
    
         | 
| 
       33 
4 
     | 
    
         
             
            module GraphQL
         
     | 
| 
       34 
5 
     | 
    
         
             
              module Tracing
         
     | 
| 
       35 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                autoload :Trace, "graphql/tracing/trace"
         
     | 
| 
      
 7 
     | 
    
         
            +
                autoload :CallLegacyTracers, "graphql/tracing/call_legacy_tracers"
         
     | 
| 
      
 8 
     | 
    
         
            +
                autoload :LegacyTrace, "graphql/tracing/legacy_trace"
         
     | 
| 
      
 9 
     | 
    
         
            +
                autoload :LegacyHooksTrace, "graphql/tracing/legacy_hooks_trace"
         
     | 
| 
      
 10 
     | 
    
         
            +
                autoload :NullTrace, "graphql/tracing/null_trace"
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                autoload :ActiveSupportNotificationsTracing, "graphql/tracing/active_support_notifications_tracing"
         
     | 
| 
      
 13 
     | 
    
         
            +
                autoload :PlatformTracing, "graphql/tracing/platform_tracing"
         
     | 
| 
      
 14 
     | 
    
         
            +
                autoload :AppOpticsTracing, "graphql/tracing/appoptics_tracing"
         
     | 
| 
      
 15 
     | 
    
         
            +
                autoload :AppsignalTracing, "graphql/tracing/appsignal_tracing"
         
     | 
| 
      
 16 
     | 
    
         
            +
                autoload :DataDogTracing, "graphql/tracing/data_dog_tracing"
         
     | 
| 
      
 17 
     | 
    
         
            +
                autoload :NewRelicTracing, "graphql/tracing/new_relic_tracing"
         
     | 
| 
      
 18 
     | 
    
         
            +
                autoload :NotificationsTracing, "graphql/tracing/notifications_tracing"
         
     | 
| 
      
 19 
     | 
    
         
            +
                autoload :ScoutTracing, "graphql/tracing/scout_tracing"
         
     | 
| 
      
 20 
     | 
    
         
            +
                autoload :StatsdTracing, "graphql/tracing/statsd_tracing"
         
     | 
| 
      
 21 
     | 
    
         
            +
                autoload :PrometheusTracing, "graphql/tracing/prometheus_tracing"
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                autoload :ActiveSupportNotificationsTrace, "graphql/tracing/active_support_notifications_trace"
         
     | 
| 
      
 24 
     | 
    
         
            +
                autoload :PlatformTrace, "graphql/tracing/platform_trace"
         
     | 
| 
      
 25 
     | 
    
         
            +
                autoload :AppOpticsTrace, "graphql/tracing/appoptics_trace"
         
     | 
| 
      
 26 
     | 
    
         
            +
                autoload :AppsignalTrace, "graphql/tracing/appsignal_trace"
         
     | 
| 
      
 27 
     | 
    
         
            +
                autoload :DataDogTrace, "graphql/tracing/data_dog_trace"
         
     | 
| 
      
 28 
     | 
    
         
            +
                autoload :NewRelicTrace, "graphql/tracing/new_relic_trace"
         
     | 
| 
      
 29 
     | 
    
         
            +
                autoload :NotificationsTrace, "graphql/tracing/notifications_trace"
         
     | 
| 
      
 30 
     | 
    
         
            +
                autoload :SentryTrace, "graphql/tracing/sentry_trace"
         
     | 
| 
      
 31 
     | 
    
         
            +
                autoload :ScoutTrace, "graphql/tracing/scout_trace"
         
     | 
| 
      
 32 
     | 
    
         
            +
                autoload :StatsdTrace, "graphql/tracing/statsd_trace"
         
     | 
| 
      
 33 
     | 
    
         
            +
                autoload :PrometheusTrace, "graphql/tracing/prometheus_trace"
         
     | 
| 
       36 
34 
     | 
    
         | 
| 
       37 
35 
     | 
    
         
             
                # Objects may include traceable to gain a `.trace(...)` method.
         
     | 
| 
       38 
36 
     | 
    
         
             
                # The object must have a `@tracers` ivar of type `Array<<#trace(k, d, &b)>>`.
         
     | 
    
        data/lib/graphql/version.rb
    CHANGED