graphql 2.4.15 → 2.5.0
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.
- checksums.yaml +4 -4
- data/lib/graphql/dashboard/detailed_traces.rb +47 -0
- data/lib/graphql/dashboard/installable.rb +22 -0
- data/lib/graphql/dashboard/limiters.rb +93 -0
- data/lib/graphql/dashboard/operation_store.rb +199 -0
- data/lib/graphql/dashboard/statics/charts.min.css +1 -0
- data/lib/graphql/dashboard/statics/dashboard.css +27 -0
- data/lib/graphql/dashboard/statics/dashboard.js +74 -9
- data/lib/graphql/dashboard/subscriptions.rb +96 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/detailed_traces/traces/index.html.erb +45 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/limiters/limiters/show.html.erb +62 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/not_installed.html.erb +18 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/_form.html.erb +23 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/edit.html.erb +21 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/index.html.erb +69 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/new.html.erb +7 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/index_entries/index.html.erb +39 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/index_entries/show.html.erb +32 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/operations/index.html.erb +81 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/operations/show.html.erb +71 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/subscriptions/subscriptions/show.html.erb +41 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/subscriptions/topics/index.html.erb +55 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/subscriptions/topics/show.html.erb +40 -0
- data/lib/graphql/dashboard/views/layouts/graphql/dashboard/application.html.erb +49 -1
- data/lib/graphql/dashboard.rb +45 -29
- data/lib/graphql/execution/interpreter.rb +3 -5
- data/lib/graphql/execution/multiplex.rb +1 -1
- data/lib/graphql/language/parser.rb +13 -6
- data/lib/graphql/query.rb +2 -4
- data/lib/graphql/static_validation/all_rules.rb +1 -1
- data/lib/graphql/static_validation/rules/not_single_subscription_error.rb +25 -0
- data/lib/graphql/static_validation/rules/subscription_root_exists_and_single_subscription_selection.rb +26 -0
- data/lib/graphql/tracing/active_support_notifications_trace.rb +7 -0
- data/lib/graphql/tracing/appoptics_tracing.rb +5 -0
- data/lib/graphql/tracing/appsignal_trace.rb +26 -61
- data/lib/graphql/tracing/data_dog_trace.rb +41 -164
- data/lib/graphql/tracing/monitor_trace.rb +285 -0
- data/lib/graphql/tracing/new_relic_trace.rb +34 -166
- data/lib/graphql/tracing/notifications_trace.rb +181 -37
- data/lib/graphql/tracing/perfetto_trace.rb +15 -18
- data/lib/graphql/tracing/prometheus_trace.rb +47 -74
- data/lib/graphql/tracing/scout_trace.rb +25 -59
- data/lib/graphql/tracing/sentry_trace.rb +57 -99
- data/lib/graphql/tracing/statsd_trace.rb +24 -47
- data/lib/graphql/tracing/trace.rb +0 -17
- data/lib/graphql/tracing.rb +1 -0
- data/lib/graphql/version.rb +1 -1
- metadata +25 -4
- data/lib/graphql/dashboard/views/graphql/dashboard/traces/index.html.erb +0 -63
- data/lib/graphql/static_validation/rules/subscription_root_exists.rb +0 -17
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "graphql/tracing/
|
3
|
+
require "graphql/tracing/monitor_trace"
|
4
4
|
|
5
5
|
module GraphQL
|
6
6
|
module Tracing
|
@@ -26,93 +26,66 @@ module GraphQL
|
|
26
26
|
#
|
27
27
|
# # Then run:
|
28
28
|
# # bundle exec prometheus_exporter -a lib/graphql_collector.rb
|
29
|
+
PrometheusTrace = MonitorTrace.create_module("prometheus")
|
29
30
|
module PrometheusTrace
|
30
31
|
if defined?(PrometheusExporter::Server)
|
31
32
|
autoload :GraphQLCollector, "graphql/tracing/prometheus_trace/graphql_collector"
|
32
33
|
end
|
33
|
-
include PlatformTrace
|
34
34
|
|
35
|
-
def initialize(client: PrometheusExporter::Client.default, keys_whitelist: [
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@
|
39
|
-
|
40
|
-
super
|
35
|
+
def initialize(client: PrometheusExporter::Client.default, keys_whitelist: [:execute_field], collector_type: "graphql", **rest)
|
36
|
+
@prometheus_client = client
|
37
|
+
@prometheus_keys_whitelist = keys_whitelist.map(&:to_sym) # handle previous string keys
|
38
|
+
@prometheus_collector_type = collector_type
|
39
|
+
setup_prometheus_monitor(**rest)
|
40
|
+
super
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
module_eval <<-RUBY, __FILE__, __LINE__
|
56
|
-
def #{trace_method}(**data)
|
57
|
-
instrument_prometheus_execution("#{platform_key}", "#{trace_method}") { super }
|
43
|
+
attr_reader :prometheus_collector_type, :prometheus_client, :prometheus_keys_whitelist
|
44
|
+
|
45
|
+
class PrometheusMonitor < MonitorTrace::Monitor
|
46
|
+
def instrument(keyword, object)
|
47
|
+
if active?(keyword)
|
48
|
+
start = gettime
|
49
|
+
result = yield
|
50
|
+
duration = gettime - start
|
51
|
+
send_json(duration, keyword, object)
|
52
|
+
result
|
53
|
+
else
|
54
|
+
yield
|
58
55
|
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
# rubocop:enable Development/NoEvalCop
|
63
|
-
|
64
|
-
def platform_execute_field(platform_key, &block)
|
65
|
-
instrument_prometheus_execution(platform_key, "execute_field", &block)
|
66
|
-
end
|
67
|
-
|
68
|
-
def platform_execute_field_lazy(platform_key, &block)
|
69
|
-
instrument_prometheus_execution(platform_key, "execute_field_lazy", &block)
|
70
|
-
end
|
71
|
-
|
72
|
-
def platform_authorized(platform_key, &block)
|
73
|
-
instrument_prometheus_execution(platform_key, "authorized", &block)
|
74
|
-
end
|
75
|
-
|
76
|
-
def platform_authorized_lazy(platform_key, &block)
|
77
|
-
instrument_prometheus_execution(platform_key, "authorized_lazy", &block)
|
78
|
-
end
|
79
|
-
|
80
|
-
def platform_resolve_type(platform_key, &block)
|
81
|
-
instrument_prometheus_execution(platform_key, "resolve_type", &block)
|
82
|
-
end
|
56
|
+
end
|
83
57
|
|
84
|
-
|
85
|
-
|
86
|
-
|
58
|
+
def active?(keyword)
|
59
|
+
@trace.prometheus_keys_whitelist.include?(keyword)
|
60
|
+
end
|
87
61
|
|
88
|
-
|
89
|
-
|
90
|
-
|
62
|
+
def gettime
|
63
|
+
::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
64
|
+
end
|
91
65
|
|
92
|
-
|
93
|
-
|
94
|
-
|
66
|
+
def send_json(duration, keyword, object)
|
67
|
+
event_name = name_for(keyword, object)
|
68
|
+
@trace.prometheus_client.send_json(
|
69
|
+
type: @trace.prometheus_collector_type,
|
70
|
+
duration: duration,
|
71
|
+
platform_key: event_name,
|
72
|
+
key: keyword
|
73
|
+
)
|
74
|
+
end
|
95
75
|
|
96
|
-
|
97
|
-
"#{type.graphql_name}.resolve_type"
|
98
|
-
end
|
76
|
+
include MonitorTrace::Monitor::GraphQLPrefixNames
|
99
77
|
|
100
|
-
|
78
|
+
class Event < MonitorTrace::Monitor::Event
|
79
|
+
def start
|
80
|
+
@start_time = @monitor.gettime
|
81
|
+
end
|
101
82
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
type: @collector_type,
|
109
|
-
duration: duration,
|
110
|
-
platform_key: platform_key,
|
111
|
-
key: key
|
112
|
-
)
|
113
|
-
result
|
114
|
-
else
|
115
|
-
yield
|
83
|
+
def finish
|
84
|
+
if @monitor.active?(keyword)
|
85
|
+
duration = @monitor.gettime - @start_time
|
86
|
+
@monitor.send_json(duration, keyword, object)
|
87
|
+
end
|
88
|
+
end
|
116
89
|
end
|
117
90
|
end
|
118
91
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "graphql/tracing/
|
3
|
+
require "graphql/tracing/monitor_trace"
|
4
4
|
|
5
5
|
module GraphQL
|
6
6
|
module Tracing
|
@@ -10,73 +10,39 @@ module GraphQL
|
|
10
10
|
# class MySchema < GraphQL::Schema
|
11
11
|
# trace_with GraphQL::Tracing::ScoutTrace
|
12
12
|
# end
|
13
|
+
ScoutTrace = MonitorTrace.create_module("scout")
|
13
14
|
module ScoutTrace
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
def initialize(set_transaction_name: false, **_rest)
|
22
|
-
self.class.include(ScoutApm::Tracer)
|
23
|
-
@set_transaction_name = set_transaction_name
|
24
|
-
super
|
25
|
-
end
|
26
|
-
|
27
|
-
# rubocop:disable Development/NoEvalCop This eval takes static inputs at load-time
|
28
|
-
|
29
|
-
{
|
30
|
-
"lex" => "lex.graphql",
|
31
|
-
"parse" => "parse.graphql",
|
32
|
-
"validate" => "validate.graphql",
|
33
|
-
"analyze_query" => "analyze.graphql",
|
34
|
-
"analyze_multiplex" => "analyze.graphql",
|
35
|
-
"execute_multiplex" => "execute.graphql",
|
36
|
-
"execute_query" => "execute.graphql",
|
37
|
-
"execute_query_lazy" => "execute.graphql",
|
38
|
-
}.each do |trace_method, platform_key|
|
39
|
-
module_eval <<-RUBY, __FILE__, __LINE__
|
40
|
-
def #{trace_method}(**data)
|
41
|
-
#{
|
42
|
-
if trace_method == "execute_query"
|
43
|
-
<<-RUBY
|
44
|
-
set_this_txn_name = data[:query].context[:set_scout_transaction_name]
|
45
|
-
if set_this_txn_name == true || (set_this_txn_name.nil? && @set_transaction_name)
|
46
|
-
ScoutApm::Transaction.rename(transaction_name(data[:query]))
|
47
|
-
end
|
48
|
-
RUBY
|
15
|
+
class ScoutMonitor < MonitorTrace::Monitor
|
16
|
+
def instrument(keyword, object)
|
17
|
+
if keyword == :execute
|
18
|
+
query = object.queries.first
|
19
|
+
set_this_txn_name = query.context[:set_scout_transaction_name]
|
20
|
+
if set_this_txn_name == true || (set_this_txn_name.nil? && @set_transaction_name)
|
21
|
+
ScoutApm::Transaction.rename(transaction_name(query))
|
49
22
|
end
|
50
|
-
|
23
|
+
end
|
51
24
|
|
52
|
-
|
53
|
-
|
25
|
+
ScoutApm::Tracer.instrument("GraphQL", name_for(keyword, object), INSTRUMENT_OPTS) do
|
26
|
+
yield
|
54
27
|
end
|
55
28
|
end
|
56
|
-
RUBY
|
57
|
-
end
|
58
|
-
# rubocop:enable Development/NoEvalCop
|
59
|
-
|
60
|
-
def platform_execute_field(platform_key, &block)
|
61
|
-
self.class.instrument("GraphQL", platform_key, INSTRUMENT_OPTS, &block)
|
62
|
-
end
|
63
|
-
|
64
|
-
def platform_authorized(platform_key, &block)
|
65
|
-
self.class.instrument("GraphQL", platform_key, INSTRUMENT_OPTS, &block)
|
66
|
-
end
|
67
29
|
|
68
|
-
|
30
|
+
INSTRUMENT_OPTS = { scope: true }
|
69
31
|
|
70
|
-
|
71
|
-
field.path
|
72
|
-
end
|
32
|
+
include MonitorTrace::Monitor::GraphQLSuffixNames
|
73
33
|
|
74
|
-
|
75
|
-
|
76
|
-
|
34
|
+
class Event < MonitorTrace::Monitor::Event
|
35
|
+
def start
|
36
|
+
layer = ScoutApm::Layer.new("GraphQL", @monitor.name_for(keyword, object))
|
37
|
+
layer.subscopable!
|
38
|
+
@scout_req = ScoutApm::RequestManager.lookup
|
39
|
+
@scout_req.start_layer(layer)
|
40
|
+
end
|
77
41
|
|
78
|
-
|
79
|
-
|
42
|
+
def finish
|
43
|
+
@scout_req.stop_layer
|
44
|
+
end
|
45
|
+
end
|
80
46
|
end
|
81
47
|
end
|
82
48
|
end
|
@@ -1,121 +1,79 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "graphql/tracing/
|
3
|
+
require "graphql/tracing/monitor_trace"
|
4
4
|
|
5
5
|
module GraphQL
|
6
6
|
module Tracing
|
7
7
|
# A tracer for reporting GraphQL-Ruby times to Sentry.
|
8
|
+
#
|
8
9
|
# @example Installing the tracer
|
9
10
|
# class MySchema < GraphQL::Schema
|
10
11
|
# trace_with GraphQL::Tracing::SentryTrace
|
11
12
|
# end
|
13
|
+
# @see MonitorTrace Configuration Options in the parent module
|
14
|
+
SentryTrace = MonitorTrace.create_module("sentry")
|
12
15
|
module SentryTrace
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
class SentryMonitor < MonitorTrace::Monitor
|
17
|
+
def instrument(keyword, object)
|
18
|
+
return yield unless Sentry.initialized?
|
19
|
+
|
20
|
+
platform_key = name_for(keyword, object)
|
21
|
+
|
22
|
+
Sentry.with_child_span(op: platform_key, start_timestamp: Sentry.utc_now.to_f) do |span|
|
23
|
+
result = yield
|
24
|
+
return result unless span
|
25
|
+
|
26
|
+
span.finish
|
27
|
+
if keyword == :execute
|
28
|
+
queries = object.queries
|
29
|
+
operation_names = queries.map{|q| operation_name(q) }
|
30
|
+
span.set_description(operation_names.join(", "))
|
31
|
+
|
32
|
+
if queries.size == 1
|
33
|
+
query = queries.first
|
34
|
+
set_this_txn_name = query.context[:set_sentry_transaction_name]
|
35
|
+
if set_this_txn_name == true || (set_this_txn_name.nil? && @set_transaction_name)
|
36
|
+
Sentry.configure_scope do |scope|
|
37
|
+
scope.set_transaction_name(transaction_name(query))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
span.set_data('graphql.document', query.query_string)
|
41
|
+
if query.selected_operation_name
|
42
|
+
span.set_data('graphql.operation.name', query.selected_operation_name)
|
43
|
+
end
|
44
|
+
span.set_data('graphql.operation.type', query.selected_operation.operation_type)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
result
|
28
49
|
end
|
29
50
|
end
|
30
|
-
instrument_sentry_execution("graphql.execute", "execute_query", data) { super }
|
31
|
-
end
|
32
51
|
|
33
|
-
|
52
|
+
include MonitorTrace::Monitor::GraphQLPrefixNames
|
34
53
|
|
35
|
-
|
36
|
-
"lex" => "graphql.lex",
|
37
|
-
"parse" => "graphql.parse",
|
38
|
-
"validate" => "graphql.validate",
|
39
|
-
"analyze_query" => "graphql.analyze",
|
40
|
-
"analyze_multiplex" => "graphql.analyze_multiplex",
|
41
|
-
"execute_multiplex" => "graphql.execute_multiplex",
|
42
|
-
"execute_query_lazy" => "graphql.execute"
|
43
|
-
}.each do |trace_method, platform_key|
|
44
|
-
module_eval <<-RUBY, __FILE__, __LINE__
|
45
|
-
def #{trace_method}(**data)
|
46
|
-
instrument_sentry_execution("#{platform_key}", "#{trace_method}", data) { super }
|
47
|
-
end
|
48
|
-
RUBY
|
49
|
-
end
|
50
|
-
|
51
|
-
# rubocop:enable Development/NoEvalCop
|
52
|
-
|
53
|
-
def platform_execute_field(platform_key, &block)
|
54
|
-
instrument_sentry_execution(platform_key, "execute_field", &block)
|
55
|
-
end
|
56
|
-
|
57
|
-
def platform_execute_field_lazy(platform_key, &block)
|
58
|
-
instrument_sentry_execution(platform_key, "execute_field_lazy", &block)
|
59
|
-
end
|
60
|
-
|
61
|
-
def platform_authorized(platform_key, &block)
|
62
|
-
instrument_sentry_execution(platform_key, "authorized", &block)
|
63
|
-
end
|
64
|
-
|
65
|
-
def platform_authorized_lazy(platform_key, &block)
|
66
|
-
instrument_sentry_execution(platform_key, "authorized_lazy", &block)
|
67
|
-
end
|
68
|
-
|
69
|
-
def platform_resolve_type(platform_key, &block)
|
70
|
-
instrument_sentry_execution(platform_key, "resolve_type", &block)
|
71
|
-
end
|
54
|
+
private
|
72
55
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
def platform_authorized_key(type)
|
82
|
-
"graphql.authorized.#{type.graphql_name}"
|
83
|
-
end
|
84
|
-
|
85
|
-
def platform_resolve_type_key(type)
|
86
|
-
"graphql.resolve_type.#{type.graphql_name}"
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def instrument_sentry_execution(platform_key, trace_method, data=nil, &block)
|
92
|
-
return yield unless Sentry.initialized?
|
93
|
-
|
94
|
-
Sentry.with_child_span(op: platform_key, start_timestamp: Sentry.utc_now.to_f) do |span|
|
95
|
-
result = yield
|
96
|
-
return result unless span
|
97
|
-
|
98
|
-
span.finish
|
99
|
-
if trace_method == "execute_multiplex" && data.key?(:multiplex)
|
100
|
-
operation_names = data[:multiplex].queries.map{|q| operation_name(q) }
|
101
|
-
span.set_description(operation_names.join(", "))
|
102
|
-
elsif trace_method == "execute_query" && data.key?(:query)
|
103
|
-
span.set_description(operation_name(data[:query]))
|
104
|
-
span.set_data('graphql.document', data[:query].query_string)
|
105
|
-
span.set_data('graphql.operation.name', data[:query].selected_operation_name) if data[:query].selected_operation_name
|
106
|
-
span.set_data('graphql.operation.type', data[:query].selected_operation.operation_type)
|
56
|
+
def operation_name(query)
|
57
|
+
selected_op = query.selected_operation
|
58
|
+
if selected_op
|
59
|
+
[selected_op.operation_type, selected_op.name].compact.join(' ')
|
60
|
+
else
|
61
|
+
'GraphQL Operation'
|
107
62
|
end
|
108
|
-
|
109
|
-
result
|
110
63
|
end
|
111
|
-
end
|
112
64
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
65
|
+
class Event < MonitorTrace::Monitor::Event
|
66
|
+
def start
|
67
|
+
if Sentry.initialized?
|
68
|
+
@span = Sentry.get_current_scope.get_span
|
69
|
+
span_name = @monitor.name_for(@keyword, @object)
|
70
|
+
@span.start_child(op: span_name)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def finish
|
75
|
+
@span&.finish
|
76
|
+
end
|
119
77
|
end
|
120
78
|
end
|
121
79
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "graphql/tracing/
|
3
|
+
require "graphql/tracing/monitor_trace"
|
4
4
|
|
5
5
|
module GraphQL
|
6
6
|
module Tracing
|
7
7
|
# A tracer for reporting GraphQL-Ruby times to Statsd.
|
8
|
-
# Passing any Statsd client that implements `.time(name) { ... }`
|
8
|
+
# Passing any Statsd client that implements `.time(name) { ... }`
|
9
|
+
# and `.timing(name, ms)` will work.
|
9
10
|
#
|
10
11
|
# @example Installing this tracer
|
11
12
|
# # eg:
|
@@ -13,58 +14,34 @@ module GraphQL
|
|
13
14
|
# class MySchema < GraphQL::Schema
|
14
15
|
# use GraphQL::Tracing::StatsdTrace, statsd: $statsd
|
15
16
|
# end
|
17
|
+
StatsdTrace = MonitorTrace.create_module("statsd")
|
16
18
|
module StatsdTrace
|
17
|
-
|
19
|
+
class StatsdMonitor < MonitorTrace::Monitor
|
20
|
+
def initialize(statsd:, **_rest)
|
21
|
+
@statsd = statsd
|
22
|
+
super
|
23
|
+
end
|
18
24
|
|
19
|
-
|
20
|
-
def initialize(statsd:, **rest)
|
21
|
-
@statsd = statsd
|
22
|
-
super(**rest)
|
23
|
-
end
|
24
|
-
|
25
|
-
# rubocop:disable Development/NoEvalCop This eval takes static inputs at load-time
|
25
|
+
attr_reader :statsd
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
'validate' => "graphql.validate",
|
31
|
-
'analyze_query' => "graphql.analyze_query",
|
32
|
-
'analyze_multiplex' => "graphql.analyze_multiplex",
|
33
|
-
'execute_multiplex' => "graphql.execute_multiplex",
|
34
|
-
'execute_query' => "graphql.execute_query",
|
35
|
-
'execute_query_lazy' => "graphql.execute_query_lazy",
|
36
|
-
}.each do |trace_method, platform_key|
|
37
|
-
module_eval <<-RUBY, __FILE__, __LINE__
|
38
|
-
def #{trace_method}(**data)
|
39
|
-
@statsd.time("#{platform_key}") do
|
40
|
-
super
|
41
|
-
end
|
27
|
+
def instrument(keyword, object)
|
28
|
+
@statsd.time(name_for(keyword, object)) do
|
29
|
+
yield
|
42
30
|
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
# rubocop:enable Development/NoEvalCop
|
31
|
+
end
|
47
32
|
|
48
|
-
|
49
|
-
@statsd.time(platform_key, &block)
|
50
|
-
end
|
51
|
-
|
52
|
-
def platform_authorized(key, &block)
|
53
|
-
@statsd.time(key, &block)
|
54
|
-
end
|
33
|
+
include MonitorTrace::Monitor::GraphQLPrefixNames
|
55
34
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def platform_authorized_key(type)
|
63
|
-
"graphql.authorized.#{type.graphql_name}"
|
64
|
-
end
|
35
|
+
class Event < MonitorTrace::Monitor::Event
|
36
|
+
def start
|
37
|
+
@start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
38
|
+
end
|
65
39
|
|
66
|
-
|
67
|
-
|
40
|
+
def finish
|
41
|
+
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time
|
42
|
+
@monitor.statsd.timing(@monitor.name_for(keyword, object), elapsed)
|
43
|
+
end
|
44
|
+
end
|
68
45
|
end
|
69
46
|
end
|
70
47
|
end
|
@@ -23,12 +23,6 @@ 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
26
|
# @param query_string [String]
|
33
27
|
# @return [void]
|
34
28
|
def parse(query_string:)
|
@@ -63,17 +57,6 @@ module GraphQL
|
|
63
57
|
yield
|
64
58
|
end
|
65
59
|
|
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
60
|
# This wraps an entire `.execute` call.
|
78
61
|
# @param multiplex [GraphQL::Execution::Multiplex]
|
79
62
|
# @return [void]
|
data/lib/graphql/tracing.rb
CHANGED
@@ -25,6 +25,7 @@ module GraphQL
|
|
25
25
|
autoload :AppOpticsTrace, "graphql/tracing/appoptics_trace"
|
26
26
|
autoload :AppsignalTrace, "graphql/tracing/appsignal_trace"
|
27
27
|
autoload :DataDogTrace, "graphql/tracing/data_dog_trace"
|
28
|
+
autoload :MonitorTrace, "graphql/tracing/monitor_trace"
|
28
29
|
autoload :NewRelicTrace, "graphql/tracing/new_relic_trace"
|
29
30
|
autoload :NotificationsTrace, "graphql/tracing/notifications_trace"
|
30
31
|
autoload :SentryTrace, "graphql/tracing/sentry_trace"
|
data/lib/graphql/version.rb
CHANGED
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
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-01 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: base64
|
@@ -432,14 +432,33 @@ files:
|
|
432
432
|
- lib/graphql/coercion_error.rb
|
433
433
|
- lib/graphql/current.rb
|
434
434
|
- lib/graphql/dashboard.rb
|
435
|
+
- lib/graphql/dashboard/detailed_traces.rb
|
436
|
+
- lib/graphql/dashboard/installable.rb
|
437
|
+
- lib/graphql/dashboard/limiters.rb
|
438
|
+
- lib/graphql/dashboard/operation_store.rb
|
435
439
|
- lib/graphql/dashboard/statics/bootstrap-5.3.3.min.css
|
436
440
|
- lib/graphql/dashboard/statics/bootstrap-5.3.3.min.js
|
441
|
+
- lib/graphql/dashboard/statics/charts.min.css
|
437
442
|
- lib/graphql/dashboard/statics/dashboard.css
|
438
443
|
- lib/graphql/dashboard/statics/dashboard.js
|
439
444
|
- lib/graphql/dashboard/statics/header-icon.png
|
440
445
|
- lib/graphql/dashboard/statics/icon.png
|
446
|
+
- lib/graphql/dashboard/subscriptions.rb
|
447
|
+
- lib/graphql/dashboard/views/graphql/dashboard/detailed_traces/traces/index.html.erb
|
441
448
|
- lib/graphql/dashboard/views/graphql/dashboard/landings/show.html.erb
|
442
|
-
- lib/graphql/dashboard/views/graphql/dashboard/
|
449
|
+
- lib/graphql/dashboard/views/graphql/dashboard/limiters/limiters/show.html.erb
|
450
|
+
- lib/graphql/dashboard/views/graphql/dashboard/not_installed.html.erb
|
451
|
+
- lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/_form.html.erb
|
452
|
+
- lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/edit.html.erb
|
453
|
+
- lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/index.html.erb
|
454
|
+
- lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/new.html.erb
|
455
|
+
- lib/graphql/dashboard/views/graphql/dashboard/operation_store/index_entries/index.html.erb
|
456
|
+
- lib/graphql/dashboard/views/graphql/dashboard/operation_store/index_entries/show.html.erb
|
457
|
+
- lib/graphql/dashboard/views/graphql/dashboard/operation_store/operations/index.html.erb
|
458
|
+
- lib/graphql/dashboard/views/graphql/dashboard/operation_store/operations/show.html.erb
|
459
|
+
- lib/graphql/dashboard/views/graphql/dashboard/subscriptions/subscriptions/show.html.erb
|
460
|
+
- lib/graphql/dashboard/views/graphql/dashboard/subscriptions/topics/index.html.erb
|
461
|
+
- lib/graphql/dashboard/views/graphql/dashboard/subscriptions/topics/show.html.erb
|
443
462
|
- lib/graphql/dashboard/views/layouts/graphql/dashboard/application.html.erb
|
444
463
|
- lib/graphql/dataloader.rb
|
445
464
|
- lib/graphql/dataloader/active_record_association_source.rb
|
@@ -657,6 +676,7 @@ files:
|
|
657
676
|
- lib/graphql/static_validation/rules/mutation_root_exists_error.rb
|
658
677
|
- lib/graphql/static_validation/rules/no_definitions_are_present.rb
|
659
678
|
- lib/graphql/static_validation/rules/no_definitions_are_present_error.rb
|
679
|
+
- lib/graphql/static_validation/rules/not_single_subscription_error.rb
|
660
680
|
- lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb
|
661
681
|
- lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb
|
662
682
|
- lib/graphql/static_validation/rules/operation_names_are_valid.rb
|
@@ -667,7 +687,7 @@ files:
|
|
667
687
|
- lib/graphql/static_validation/rules/required_arguments_are_present_error.rb
|
668
688
|
- lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb
|
669
689
|
- lib/graphql/static_validation/rules/required_input_object_attributes_are_present_error.rb
|
670
|
-
- lib/graphql/static_validation/rules/
|
690
|
+
- lib/graphql/static_validation/rules/subscription_root_exists_and_single_subscription_selection.rb
|
671
691
|
- lib/graphql/static_validation/rules/subscription_root_exists_error.rb
|
672
692
|
- lib/graphql/static_validation/rules/unique_directives_per_location.rb
|
673
693
|
- lib/graphql/static_validation/rules/unique_directives_per_location_error.rb
|
@@ -708,6 +728,7 @@ files:
|
|
708
728
|
- lib/graphql/tracing/detailed_trace/redis_backend.rb
|
709
729
|
- lib/graphql/tracing/legacy_hooks_trace.rb
|
710
730
|
- lib/graphql/tracing/legacy_trace.rb
|
731
|
+
- lib/graphql/tracing/monitor_trace.rb
|
711
732
|
- lib/graphql/tracing/new_relic_trace.rb
|
712
733
|
- lib/graphql/tracing/new_relic_tracing.rb
|
713
734
|
- lib/graphql/tracing/notifications_trace.rb
|