graphql 2.2.10 → 2.2.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.
Potentially problematic release.
This version of graphql might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/graphql/schema.rb +21 -10
- data/lib/graphql/tracing/sentry_trace.rb +18 -1
- data/lib/graphql/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bae060f1dcf449082e9e53be024476505d848448a13d592f31e67c11024caa4
|
4
|
+
data.tar.gz: ebc753b89b657c18771641869a4dffea9e79fe324a3f7e46c1a84304a6cc3375
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bd27d12cd1efd1c4166c20062e401fa524bcda469de51cbfe89fd21542fd3433a2f23628c21330c9e3d700a9627c683a6a1691887a06ef06105ede4c2241b26
|
7
|
+
data.tar.gz: abc65a9217ae76239458695a3ee47d3e2bf3d072e16d62b9df16a65a380110e4a9a207af17473ca0f14fcce5d907a2552866597dd53785c890979a37aa2c500b
|
data/lib/graphql/schema.rb
CHANGED
@@ -167,13 +167,20 @@ module GraphQL
|
|
167
167
|
backtrace_class.include(GraphQL::Backtrace::Trace)
|
168
168
|
trace_mode(:default_backtrace, backtrace_class)
|
169
169
|
end
|
170
|
-
trace_class_for(:default)
|
170
|
+
trace_class_for(:default, build: true)
|
171
171
|
end
|
172
172
|
|
173
173
|
# @return [Class] Return the trace class to use for this mode, looking one up on the superclass if this Schema doesn't have one defined.
|
174
|
-
def trace_class_for(mode, build:
|
175
|
-
own_trace_modes[mode]
|
176
|
-
|
174
|
+
def trace_class_for(mode, build: false)
|
175
|
+
if (trace_class = own_trace_modes[mode])
|
176
|
+
trace_class
|
177
|
+
elsif superclass.respond_to?(:trace_class_for) && (trace_class = superclass.trace_class_for(mode, build: false))
|
178
|
+
trace_class
|
179
|
+
elsif build
|
180
|
+
own_trace_modes[mode] = build_trace_mode(mode)
|
181
|
+
else
|
182
|
+
nil
|
183
|
+
end
|
177
184
|
end
|
178
185
|
|
179
186
|
# Configure `trace_class` to be used whenever `context: { trace_mode: mode_name }` is requested.
|
@@ -211,14 +218,14 @@ module GraphQL
|
|
211
218
|
include DefaultTraceClass
|
212
219
|
end
|
213
220
|
when :default_backtrace
|
214
|
-
schema_base_class = trace_class_for(:default)
|
221
|
+
schema_base_class = trace_class_for(:default, build: true)
|
215
222
|
Class.new(schema_base_class) do
|
216
223
|
include(GraphQL::Backtrace::Trace)
|
217
224
|
end
|
218
225
|
else
|
219
226
|
# First, see if the superclass has a custom-defined class for this.
|
220
227
|
# Then, if it doesn't, use this class's default trace
|
221
|
-
base_class = (superclass.respond_to?(:trace_class_for) && superclass.trace_class_for(mode
|
228
|
+
base_class = (superclass.respond_to?(:trace_class_for) && superclass.trace_class_for(mode)) || trace_class_for(:default, build: true)
|
222
229
|
# Prepare the default trace class if it hasn't been initialized yet
|
223
230
|
base_class ||= (own_trace_modes[:default] = build_trace_mode(:default))
|
224
231
|
mods = trace_modules_for(mode)
|
@@ -1111,7 +1118,7 @@ module GraphQL
|
|
1111
1118
|
end
|
1112
1119
|
|
1113
1120
|
def tracer(new_tracer)
|
1114
|
-
default_trace = trace_class_for(:default)
|
1121
|
+
default_trace = trace_class_for(:default, build: true)
|
1115
1122
|
if default_trace.nil? || !(default_trace < GraphQL::Tracing::CallLegacyTracers)
|
1116
1123
|
trace_with(GraphQL::Tracing::CallLegacyTracers)
|
1117
1124
|
end
|
@@ -1163,10 +1170,14 @@ module GraphQL
|
|
1163
1170
|
def trace_options_for(mode)
|
1164
1171
|
@trace_options_for_mode ||= {}
|
1165
1172
|
@trace_options_for_mode[mode] ||= begin
|
1173
|
+
# It may be time to create an options hash for a mode that wasn't registered yet.
|
1174
|
+
# Mix in the default options in that case.
|
1175
|
+
default_options = mode == :default ? EMPTY_HASH : trace_options_for(:default)
|
1176
|
+
# Make sure this returns a new object so that other hashes aren't modified later
|
1166
1177
|
if superclass.respond_to?(:trace_options_for)
|
1167
|
-
superclass.trace_options_for(mode).
|
1178
|
+
superclass.trace_options_for(mode).merge(default_options)
|
1168
1179
|
else
|
1169
|
-
|
1180
|
+
default_options.dup
|
1170
1181
|
end
|
1171
1182
|
end
|
1172
1183
|
end
|
@@ -1199,7 +1210,7 @@ module GraphQL
|
|
1199
1210
|
options_trace_mode ||= trace_mode
|
1200
1211
|
base_trace_options = trace_options_for(options_trace_mode)
|
1201
1212
|
trace_options = base_trace_options.merge(options)
|
1202
|
-
trace_class_for_mode = trace_class_for(trace_mode
|
1213
|
+
trace_class_for_mode = trace_class_for(trace_mode, build: true)
|
1203
1214
|
trace_class_for_mode.new(**trace_options)
|
1204
1215
|
end
|
1205
1216
|
|
@@ -5,6 +5,24 @@ module GraphQL
|
|
5
5
|
module SentryTrace
|
6
6
|
include PlatformTrace
|
7
7
|
|
8
|
+
# @param set_transaction_name [Boolean] If true, the GraphQL operation name will be used as the transaction name.
|
9
|
+
# This is not advised if you run more than one query per HTTP request, for example, with `graphql-client` or multiplexing.
|
10
|
+
# It can also be specified per-query with `context[:set_sentry_transaction_name]`.
|
11
|
+
def initialize(set_transaction_name: false, **_rest)
|
12
|
+
@set_transaction_name = set_transaction_name
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute_query(**data)
|
17
|
+
set_this_txn_name = data[:query].context[:set_sentry_transaction_name]
|
18
|
+
if set_this_txn_name == true || (set_this_txn_name.nil? && @set_transaction_name)
|
19
|
+
Sentry.configure_scope do |scope|
|
20
|
+
scope.set_transaction_name(transaction_name(data[:query]))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
instrument_execution("graphql.execute", "execute_query", data) { super }
|
24
|
+
end
|
25
|
+
|
8
26
|
{
|
9
27
|
"lex" => "graphql.lex",
|
10
28
|
"parse" => "graphql.parse",
|
@@ -12,7 +30,6 @@ module GraphQL
|
|
12
30
|
"analyze_query" => "graphql.analyze",
|
13
31
|
"analyze_multiplex" => "graphql.analyze_multiplex",
|
14
32
|
"execute_multiplex" => "graphql.execute_multiplex",
|
15
|
-
"execute_query" => "graphql.execute",
|
16
33
|
"execute_query_lazy" => "graphql.execute"
|
17
34
|
}.each do |trace_method, platform_key|
|
18
35
|
module_eval <<-RUBY, __FILE__, __LINE__
|
data/lib/graphql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -631,7 +631,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
631
631
|
- !ruby/object:Gem::Version
|
632
632
|
version: '0'
|
633
633
|
requirements: []
|
634
|
-
rubygems_version: 3.5.
|
634
|
+
rubygems_version: 3.5.3
|
635
635
|
signing_key:
|
636
636
|
specification_version: 4
|
637
637
|
summary: A GraphQL language and runtime for Ruby
|