graphql 2.4.9 → 2.4.11

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql/current.rb +5 -0
  3. data/lib/graphql/dashboard/statics/bootstrap-5.3.3.min.css +6 -0
  4. data/lib/graphql/dashboard/statics/bootstrap-5.3.3.min.js +7 -0
  5. data/lib/graphql/dashboard/statics/dashboard.css +3 -0
  6. data/lib/graphql/dashboard/statics/dashboard.js +78 -0
  7. data/lib/graphql/dashboard/statics/header-icon.png +0 -0
  8. data/lib/graphql/dashboard/statics/icon.png +0 -0
  9. data/lib/graphql/dashboard/views/graphql/dashboard/landings/show.html.erb +18 -0
  10. data/lib/graphql/dashboard/views/graphql/dashboard/traces/index.html.erb +63 -0
  11. data/lib/graphql/dashboard/views/layouts/graphql/dashboard/application.html.erb +60 -0
  12. data/lib/graphql/dashboard.rb +142 -0
  13. data/lib/graphql/dataloader/active_record_association_source.rb +64 -0
  14. data/lib/graphql/dataloader/active_record_source.rb +26 -0
  15. data/lib/graphql/dataloader/async_dataloader.rb +17 -5
  16. data/lib/graphql/dataloader/null_dataloader.rb +1 -1
  17. data/lib/graphql/dataloader/source.rb +2 -2
  18. data/lib/graphql/dataloader.rb +37 -5
  19. data/lib/graphql/execution/interpreter/runtime.rb +26 -7
  20. data/lib/graphql/execution/interpreter.rb +9 -1
  21. data/lib/graphql/invalid_name_error.rb +1 -1
  22. data/lib/graphql/invalid_null_error.rb +6 -12
  23. data/lib/graphql/language/parser.rb +1 -1
  24. data/lib/graphql/query.rb +8 -4
  25. data/lib/graphql/schema/build_from_definition.rb +0 -1
  26. data/lib/graphql/schema/enum.rb +17 -2
  27. data/lib/graphql/schema/input_object.rb +1 -1
  28. data/lib/graphql/schema/interface.rb +1 -0
  29. data/lib/graphql/schema/member/has_dataloader.rb +60 -0
  30. data/lib/graphql/schema/member.rb +1 -0
  31. data/lib/graphql/schema/object.rb +17 -8
  32. data/lib/graphql/schema/resolver.rb +1 -5
  33. data/lib/graphql/schema/visibility/profile.rb +4 -4
  34. data/lib/graphql/schema/visibility.rb +14 -9
  35. data/lib/graphql/schema.rb +52 -10
  36. data/lib/graphql/static_validation/validator.rb +6 -1
  37. data/lib/graphql/tracing/active_support_notifications_trace.rb +6 -2
  38. data/lib/graphql/tracing/appoptics_trace.rb +3 -1
  39. data/lib/graphql/tracing/appsignal_trace.rb +6 -0
  40. data/lib/graphql/tracing/data_dog_trace.rb +5 -0
  41. data/lib/graphql/tracing/detailed_trace/memory_backend.rb +60 -0
  42. data/lib/graphql/tracing/detailed_trace/redis_backend.rb +72 -0
  43. data/lib/graphql/tracing/detailed_trace.rb +93 -0
  44. data/lib/graphql/tracing/new_relic_trace.rb +147 -41
  45. data/lib/graphql/tracing/perfetto_trace/trace.proto +141 -0
  46. data/lib/graphql/tracing/perfetto_trace/trace_pb.rb +33 -0
  47. data/lib/graphql/tracing/perfetto_trace.rb +737 -0
  48. data/lib/graphql/tracing/prometheus_trace.rb +22 -0
  49. data/lib/graphql/tracing/scout_trace.rb +6 -0
  50. data/lib/graphql/tracing/sentry_trace.rb +5 -0
  51. data/lib/graphql/tracing/statsd_trace.rb +9 -0
  52. data/lib/graphql/tracing/trace.rb +124 -0
  53. data/lib/graphql/tracing.rb +2 -0
  54. data/lib/graphql/version.rb +1 -1
  55. data/lib/graphql.rb +3 -0
  56. metadata +49 -3
  57. data/lib/graphql/schema/null_mask.rb +0 -11
@@ -4,6 +4,28 @@ require "graphql/tracing/platform_trace"
4
4
 
5
5
  module GraphQL
6
6
  module Tracing
7
+ # A tracer for reporting GraphQL-Ruby times to Prometheus.
8
+ #
9
+ # The PrometheusExporter server must be run with a custom type collector that extends `GraphQL::Tracing::PrometheusTracing::GraphQLCollector`.
10
+ #
11
+ # @example Adding this trace to your schema
12
+ # require 'prometheus_exporter/client'
13
+ #
14
+ # class MySchema < GraphQL::Schema
15
+ # trace_with GraphQL::Tracing::PrometheusTrace
16
+ # end
17
+ #
18
+ # @example Running a custom type collector
19
+ # # lib/graphql_collector.rb
20
+ # if defined?(PrometheusExporter::Server)
21
+ # require 'graphql/tracing'
22
+ #
23
+ # class GraphQLCollector < GraphQL::Tracing::PrometheusTrace::GraphQLCollector
24
+ # end
25
+ # end
26
+ #
27
+ # # Then run:
28
+ # # bundle exec prometheus_exporter -a lib/graphql_collector.rb
7
29
  module PrometheusTrace
8
30
  if defined?(PrometheusExporter::Server)
9
31
  autoload :GraphQLCollector, "graphql/tracing/prometheus_trace/graphql_collector"
@@ -4,6 +4,12 @@ require "graphql/tracing/platform_trace"
4
4
 
5
5
  module GraphQL
6
6
  module Tracing
7
+ # A tracer for sending GraphQL-Ruby times to Scout
8
+ #
9
+ # @example Adding this tracer to your schema
10
+ # class MySchema < GraphQL::Schema
11
+ # trace_with GraphQL::Tracing::ScoutTrace
12
+ # end
7
13
  module ScoutTrace
8
14
  include PlatformTrace
9
15
 
@@ -4,6 +4,11 @@ require "graphql/tracing/platform_trace"
4
4
 
5
5
  module GraphQL
6
6
  module Tracing
7
+ # A tracer for reporting GraphQL-Ruby times to Sentry.
8
+ # @example Installing the tracer
9
+ # class MySchema < GraphQL::Schema
10
+ # trace_with GraphQL::Tracing::SentryTrace
11
+ # end
7
12
  module SentryTrace
8
13
  include PlatformTrace
9
14
 
@@ -4,6 +4,15 @@ require "graphql/tracing/platform_trace"
4
4
 
5
5
  module GraphQL
6
6
  module Tracing
7
+ # A tracer for reporting GraphQL-Ruby times to Statsd.
8
+ # Passing any Statsd client that implements `.time(name) { ... }` will work.
9
+ #
10
+ # @example Installing this tracer
11
+ # # eg:
12
+ # # $statsd = Statsd.new 'localhost', 9125
13
+ # class MySchema < GraphQL::Schema
14
+ # use GraphQL::Tracing::StatsdTrace, statsd: $statsd
15
+ # end
7
16
  module StatsdTrace
8
17
  include PlatformTrace
9
18
 
@@ -23,6 +23,14 @@ module GraphQL
23
23
  yield
24
24
  end
25
25
 
26
+ # @param query_str [String]
27
+ # @return [void]
28
+ def begin_parse(query_str); end;
29
+ # @param query_str [String]
30
+ # @return [void]
31
+ def end_parse(query_str); end;
32
+ # @param query_string [String]
33
+ # @return [void]
26
34
  def parse(query_string:)
27
35
  yield
28
36
  end
@@ -31,6 +39,22 @@ module GraphQL
31
39
  yield
32
40
  end
33
41
 
42
+ def begin_validate(query, validate)
43
+ end
44
+
45
+ def end_validate(query, validate, errors)
46
+ end
47
+
48
+ # @param multiplex [GraphQL::Execution::Multiplex]
49
+ # @param analyzers [Array<Class>]
50
+ # @return [void]
51
+ def begin_analyze_multiplex(multiplex, analyzers); end
52
+ # @param multiplex [GraphQL::Execution::Multiplex]
53
+ # @param analyzers [Array<Class>]
54
+ # @return [void]
55
+ def end_analyze_multiplex(multiplex, analyzers); end
56
+ # @param multiplex [GraphQL::Execution::Multiplex]
57
+ # @return [void]
34
58
  def analyze_multiplex(multiplex:)
35
59
  yield
36
60
  end
@@ -39,6 +63,20 @@ module GraphQL
39
63
  yield
40
64
  end
41
65
 
66
+ # This is the first event in the tracing lifecycle.
67
+ # Every Query is technically run _inside_ a {GraphQL::Multiplex}.
68
+ # @param multiplex [GraphQL::Execution::Multiplex]
69
+ # @return [void]
70
+ def begin_execute_multiplex(multiplex); end;
71
+
72
+ # This is the last event of the tracing lifecycle.
73
+ # @param multiplex [GraphQL::Execution::Multiplex]
74
+ # @return [void]
75
+ def end_execute_multiplex(multiplex); end;
76
+
77
+ # This wraps an entire `.execute` call.
78
+ # @param multiplex [GraphQL::Execution::Multiplex]
79
+ # @return [void]
42
80
  def execute_multiplex(multiplex:)
43
81
  yield
44
82
  end
@@ -51,6 +89,20 @@ module GraphQL
51
89
  yield
52
90
  end
53
91
 
92
+ # GraphQL is about to resolve this field
93
+ # @param field [GraphQL::Schema::Field]
94
+ # @param object [GraphQL::Schema::Object]
95
+ # @param arguments [Hash]
96
+ # @param query [GraphQL::Query]
97
+ def begin_execute_field(field, object, arguments, query); end
98
+ # GraphQL just finished resolving this field
99
+ # @param field [GraphQL::Schema::Field]
100
+ # @param object [GraphQL::Schema::Object]
101
+ # @param arguments [Hash]
102
+ # @param query [GraphQL::Query]
103
+ # @param result [Object]
104
+ def end_execute_field(field, object, arguments, query, result); end
105
+
54
106
  def execute_field(field:, query:, ast_node:, arguments:, object:)
55
107
  yield
56
108
  end
@@ -63,6 +115,22 @@ module GraphQL
63
115
  yield
64
116
  end
65
117
 
118
+ # A call to `.authorized?` is starting
119
+ # @param type [Class<GraphQL::Schema::Object>]
120
+ # @param object [Object]
121
+ # @param context [GraphQL::Query::Context]
122
+ # @return [void]
123
+ def begin_authorized(type, object, context)
124
+ end
125
+ # A call to `.authorized?` just finished
126
+ # @param type [Class<GraphQL::Schema::Object>]
127
+ # @param object [Object]
128
+ # @param context [GraphQL::Query::Context]
129
+ # @param authorized_result [Boolean]
130
+ # @return [void]
131
+ def end_authorized(type, object, context, authorized_result)
132
+ end
133
+
66
134
  def authorized_lazy(query:, type:, object:)
67
135
  yield
68
136
  end
@@ -74,6 +142,62 @@ module GraphQL
74
142
  def resolve_type_lazy(query:, type:, object:)
75
143
  yield
76
144
  end
145
+
146
+ # A call to `.resolve_type` is starting
147
+ # @param type [Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface>]
148
+ # @param value [Object]
149
+ # @param context [GraphQL::Query::Context]
150
+ # @return [void]
151
+ def begin_resolve_type(type, value, context)
152
+ end
153
+
154
+ # A call to `.resolve_type` just ended
155
+ # @param type [Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface>]
156
+ # @param value [Object]
157
+ # @param context [GraphQL::Query::Context]
158
+ # @param resolved_type [Class<GraphQL::Schema::Object>]
159
+ # @return [void]
160
+ def end_resolve_type(type, value, context, resolved_type)
161
+ end
162
+
163
+ # A dataloader run is starting
164
+ # @param dataloader [GraphQL::Dataloader]
165
+ # @return [void]
166
+ def begin_dataloader(dataloader); end
167
+ # A dataloader run has ended
168
+ # @param dataloder [GraphQL::Dataloader]
169
+ # @return [void]
170
+ def end_dataloader(dataloader); end
171
+
172
+ # A source with pending keys is about to fetch
173
+ # @param source [GraphQL::Dataloader::Source]
174
+ # @return [void]
175
+ def begin_dataloader_source(source); end
176
+ # A fetch call has just ended
177
+ # @param source [GraphQL::Dataloader::Source]
178
+ # @return [void]
179
+ def end_dataloader_source(source); end
180
+
181
+ # Called when Dataloader spins up a new fiber for GraphQL execution
182
+ # @param jobs [Array<#call>] Execution steps to run
183
+ # @return [void]
184
+ def dataloader_spawn_execution_fiber(jobs); end
185
+ # Called when Dataloader spins up a new fiber for fetching data
186
+ # @param pending_sources [GraphQL::Dataloader::Source] Instances with pending keys
187
+ # @return [void]
188
+ def dataloader_spawn_source_fiber(pending_sources); end
189
+ # Called when an execution or source fiber terminates
190
+ # @return [void]
191
+ def dataloader_fiber_exit; end
192
+
193
+ # Called when a Dataloader fiber is paused to wait for data
194
+ # @param source [GraphQL::Dataloader::Source] The Source whose `load` call initiated this `yield`
195
+ # @return [void]
196
+ def dataloader_fiber_yield(source); end
197
+ # Called when a Dataloader fiber is resumed because data has been loaded
198
+ # @param source [GraphQL::Dataloader::Source] The Source whose `load` call previously caused this Fiber to wait
199
+ # @return [void]
200
+ def dataloader_fiber_resume(source); end
77
201
  end
78
202
  end
79
203
  end
@@ -31,6 +31,8 @@ module GraphQL
31
31
  autoload :ScoutTrace, "graphql/tracing/scout_trace"
32
32
  autoload :StatsdTrace, "graphql/tracing/statsd_trace"
33
33
  autoload :PrometheusTrace, "graphql/tracing/prometheus_trace"
34
+ autoload :PerfettoTrace, "graphql/tracing/perfetto_trace"
35
+ autoload :DetailedTrace, "graphql/tracing/detailed_trace"
34
36
 
35
37
  # Objects may include traceable to gain a `.trace(...)` method.
36
38
  # The object must have a `@tracers` ivar of type `Array<<#trace(k, d, &b)>>`.
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.4.9"
3
+ VERSION = "2.4.11"
4
4
  end
data/lib/graphql.rb CHANGED
@@ -125,6 +125,9 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
125
125
  autoload :LoadApplicationObjectFailedError, "graphql/load_application_object_failed_error"
126
126
  autoload :Testing, "graphql/testing"
127
127
  autoload :Current, "graphql/current"
128
+ if defined?(::Rails::Engine)
129
+ autoload :Dashboard, 'graphql/dashboard'
130
+ end
128
131
  end
129
132
 
130
133
  require "graphql/version"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.9
4
+ version: 2.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-29 00:00:00.000000000 Z
10
+ date: 2025-02-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64
@@ -79,6 +79,20 @@ dependencies:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '1.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: google-protobuf
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
82
96
  - !ruby/object:Gem::Dependency
83
97
  name: graphql-batch
84
98
  requirement: !ruby/object:Gem::Requirement
@@ -275,6 +289,20 @@ dependencies:
275
289
  - - ">="
276
290
  - !ruby/object:Gem::Version
277
291
  version: '0'
292
+ - !ruby/object:Gem::Dependency
293
+ name: jekyll-sass-converter
294
+ requirement: !ruby/object:Gem::Requirement
295
+ requirements:
296
+ - - "~>"
297
+ - !ruby/object:Gem::Version
298
+ version: '2.2'
299
+ type: :development
300
+ prerelease: false
301
+ version_requirements: !ruby/object:Gem::Requirement
302
+ requirements:
303
+ - - "~>"
304
+ - !ruby/object:Gem::Version
305
+ version: '2.2'
278
306
  - !ruby/object:Gem::Dependency
279
307
  name: yard
280
308
  requirement: !ruby/object:Gem::Requirement
@@ -431,7 +459,19 @@ files:
431
459
  - lib/graphql/backtrace/traced_error.rb
432
460
  - lib/graphql/coercion_error.rb
433
461
  - lib/graphql/current.rb
462
+ - lib/graphql/dashboard.rb
463
+ - lib/graphql/dashboard/statics/bootstrap-5.3.3.min.css
464
+ - lib/graphql/dashboard/statics/bootstrap-5.3.3.min.js
465
+ - lib/graphql/dashboard/statics/dashboard.css
466
+ - lib/graphql/dashboard/statics/dashboard.js
467
+ - lib/graphql/dashboard/statics/header-icon.png
468
+ - lib/graphql/dashboard/statics/icon.png
469
+ - lib/graphql/dashboard/views/graphql/dashboard/landings/show.html.erb
470
+ - lib/graphql/dashboard/views/graphql/dashboard/traces/index.html.erb
471
+ - lib/graphql/dashboard/views/layouts/graphql/dashboard/application.html.erb
434
472
  - lib/graphql/dataloader.rb
473
+ - lib/graphql/dataloader/active_record_association_source.rb
474
+ - lib/graphql/dataloader/active_record_source.rb
435
475
  - lib/graphql/dataloader/async_dataloader.rb
436
476
  - lib/graphql/dataloader/null_dataloader.rb
437
477
  - lib/graphql/dataloader/request.rb
@@ -560,6 +600,7 @@ files:
560
600
  - lib/graphql/schema/member/graphql_type_names.rb
561
601
  - lib/graphql/schema/member/has_arguments.rb
562
602
  - lib/graphql/schema/member/has_ast_node.rb
603
+ - lib/graphql/schema/member/has_dataloader.rb
563
604
  - lib/graphql/schema/member/has_deprecation_reason.rb
564
605
  - lib/graphql/schema/member/has_directives.rb
565
606
  - lib/graphql/schema/member/has_fields.rb
@@ -573,7 +614,6 @@ files:
573
614
  - lib/graphql/schema/member/validates_input.rb
574
615
  - lib/graphql/schema/mutation.rb
575
616
  - lib/graphql/schema/non_null.rb
576
- - lib/graphql/schema/null_mask.rb
577
617
  - lib/graphql/schema/object.rb
578
618
  - lib/graphql/schema/printer.rb
579
619
  - lib/graphql/schema/relay_classic_mutation.rb
@@ -691,6 +731,9 @@ files:
691
731
  - lib/graphql/tracing/call_legacy_tracers.rb
692
732
  - lib/graphql/tracing/data_dog_trace.rb
693
733
  - lib/graphql/tracing/data_dog_tracing.rb
734
+ - lib/graphql/tracing/detailed_trace.rb
735
+ - lib/graphql/tracing/detailed_trace/memory_backend.rb
736
+ - lib/graphql/tracing/detailed_trace/redis_backend.rb
694
737
  - lib/graphql/tracing/legacy_hooks_trace.rb
695
738
  - lib/graphql/tracing/legacy_trace.rb
696
739
  - lib/graphql/tracing/new_relic_trace.rb
@@ -698,6 +741,9 @@ files:
698
741
  - lib/graphql/tracing/notifications_trace.rb
699
742
  - lib/graphql/tracing/notifications_tracing.rb
700
743
  - lib/graphql/tracing/null_trace.rb
744
+ - lib/graphql/tracing/perfetto_trace.rb
745
+ - lib/graphql/tracing/perfetto_trace/trace.proto
746
+ - lib/graphql/tracing/perfetto_trace/trace_pb.rb
701
747
  - lib/graphql/tracing/platform_trace.rb
702
748
  - lib/graphql/tracing/platform_tracing.rb
703
749
  - lib/graphql/tracing/prometheus_trace.rb
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
- module GraphQL
3
- class Schema
4
- # @api private
5
- module NullMask
6
- def self.call(member, ctx)
7
- false
8
- end
9
- end
10
- end
11
- end