graphql 2.4.8 → 2.4.10

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql/backtrace/table.rb +95 -55
  3. data/lib/graphql/backtrace.rb +1 -19
  4. data/lib/graphql/current.rb +5 -0
  5. data/lib/graphql/dataloader/active_record_association_source.rb +64 -0
  6. data/lib/graphql/dataloader/active_record_source.rb +26 -0
  7. data/lib/graphql/dataloader/async_dataloader.rb +17 -5
  8. data/lib/graphql/dataloader/null_dataloader.rb +1 -1
  9. data/lib/graphql/dataloader/source.rb +2 -2
  10. data/lib/graphql/dataloader.rb +37 -5
  11. data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +11 -4
  12. data/lib/graphql/execution/interpreter/runtime.rb +59 -32
  13. data/lib/graphql/execution/interpreter.rb +9 -1
  14. data/lib/graphql/execution/multiplex.rb +0 -4
  15. data/lib/graphql/introspection/directive_location_enum.rb +1 -1
  16. data/lib/graphql/language/parser.rb +1 -1
  17. data/lib/graphql/query.rb +8 -12
  18. data/lib/graphql/schema/build_from_definition.rb +1 -0
  19. data/lib/graphql/schema/enum.rb +21 -1
  20. data/lib/graphql/schema/interface.rb +1 -0
  21. data/lib/graphql/schema/loader.rb +1 -0
  22. data/lib/graphql/schema/member/has_dataloader.rb +56 -0
  23. data/lib/graphql/schema/member.rb +1 -0
  24. data/lib/graphql/schema/object.rb +17 -8
  25. data/lib/graphql/schema/resolver.rb +2 -5
  26. data/lib/graphql/schema/validator/required_validator.rb +23 -6
  27. data/lib/graphql/schema/visibility/profile.rb +5 -5
  28. data/lib/graphql/schema/visibility.rb +14 -9
  29. data/lib/graphql/schema.rb +9 -25
  30. data/lib/graphql/static_validation/validator.rb +6 -1
  31. data/lib/graphql/subscriptions/serialize.rb +1 -3
  32. data/lib/graphql/tracing/appoptics_trace.rb +1 -1
  33. data/lib/graphql/tracing/new_relic_trace.rb +138 -41
  34. data/lib/graphql/tracing/perfetto_trace/trace.proto +141 -0
  35. data/lib/graphql/tracing/perfetto_trace/trace_pb.rb +33 -0
  36. data/lib/graphql/tracing/perfetto_trace.rb +726 -0
  37. data/lib/graphql/tracing/trace.rb +125 -1
  38. data/lib/graphql/tracing.rb +1 -0
  39. data/lib/graphql/version.rb +1 -1
  40. metadata +135 -10
  41. data/lib/graphql/backtrace/inspect_result.rb +0 -38
  42. data/lib/graphql/backtrace/trace.rb +0 -93
  43. data/lib/graphql/backtrace/tracer.rb +0 -80
  44. data/lib/graphql/schema/null_mask.rb +0 -11
@@ -13,6 +13,10 @@ module GraphQL
13
13
  # @param preload [Boolean] if `true`, load the default schema profile and all named profiles immediately (defaults to `true` for `Rails.env.production?`)
14
14
  # @param migration_errors [Boolean] if `true`, raise an error when `Visibility` and `Warden` return different results
15
15
  def self.use(schema, dynamic: false, profiles: EmptyObjects::EMPTY_HASH, preload: (defined?(Rails) ? Rails.env.production? : nil), migration_errors: false)
16
+ profiles&.each { |name, ctx|
17
+ ctx[:visibility_profile] = name
18
+ ctx.freeze
19
+ }
16
20
  schema.visibility = self.new(schema, dynamic: dynamic, preload: preload, profiles: profiles, migration_errors: migration_errors)
17
21
  if preload
18
22
  schema.visibility.preload
@@ -81,8 +85,7 @@ module GraphQL
81
85
  types_to_visit.compact!
82
86
  ensure_all_loaded(types_to_visit)
83
87
  @profiles.each do |profile_name, example_ctx|
84
- example_ctx[:visibility_profile] = profile_name
85
- prof = profile_for(example_ctx, profile_name)
88
+ prof = profile_for(example_ctx)
86
89
  prof.all_types # force loading
87
90
  end
88
91
  end
@@ -145,7 +148,7 @@ module GraphQL
145
148
 
146
149
  attr_reader :cached_profiles
147
150
 
148
- def profile_for(context, visibility_profile)
151
+ def profile_for(context, visibility_profile = context[:visibility_profile])
149
152
  if !@profiles.empty?
150
153
  if visibility_profile.nil?
151
154
  if @dynamic
@@ -160,7 +163,8 @@ module GraphQL
160
163
  elsif !@profiles.include?(visibility_profile)
161
164
  raise ArgumentError, "`#{visibility_profile.inspect}` isn't allowed for `visibility_profile:` (must be one of #{@profiles.keys.map(&:inspect).join(", ")}). Or, add `#{visibility_profile.inspect}` to the list of profiles in the schema definition."
162
165
  else
163
- @cached_profiles[visibility_profile] ||= @schema.visibility_profile_class.new(name: visibility_profile, context: context, schema: @schema)
166
+ profile_ctx = @profiles[visibility_profile]
167
+ @cached_profiles[visibility_profile] ||= @schema.visibility_profile_class.new(name: visibility_profile, context: profile_ctx, schema: @schema)
164
168
  end
165
169
  elsif context.is_a?(Query::NullContext)
166
170
  top_level_profile
@@ -222,7 +226,9 @@ module GraphQL
222
226
  elsif member.respond_to?(:interface_type_memberships)
223
227
  member.interface_type_memberships.each do |itm|
224
228
  @all_references[itm.abstract_type] << member
225
- @interface_type_memberships[itm.abstract_type] << itm
229
+ # `itm.object_type` may not actually be `member` if this implementation
230
+ # is inherited from a superclass
231
+ @interface_type_memberships[itm.abstract_type] << [itm, member]
226
232
  end
227
233
  elsif member < GraphQL::Schema::Union
228
234
  @unions_for_references << member
@@ -271,13 +277,12 @@ module GraphQL
271
277
 
272
278
  # TODO: somehow don't iterate over all these,
273
279
  # only the ones that may have been modified
274
- @interface_type_memberships.each do |int_type, type_memberships|
280
+ @interface_type_memberships.each do |int_type, type_membership_pairs|
275
281
  referers = @all_references[int_type].select { |r| r.is_a?(GraphQL::Schema::Field) }
276
282
  if !referers.empty?
277
- type_memberships.each do |type_membership|
278
- implementor_type = type_membership.object_type
283
+ type_membership_pairs.each do |(type_membership, impl_type)|
279
284
  # Add new items only:
280
- @all_references[implementor_type] |= referers
285
+ @all_references[impl_type] |= referers
281
286
  end
282
287
  end
283
288
  end
@@ -7,7 +7,6 @@ require "graphql/schema/find_inherited_value"
7
7
  require "graphql/schema/finder"
8
8
  require "graphql/schema/introspection_system"
9
9
  require "graphql/schema/late_bound_type"
10
- require "graphql/schema/null_mask"
11
10
  require "graphql/schema/timeout"
12
11
  require "graphql/schema/type_expression"
13
12
  require "graphql/schema/unique_within_type"
@@ -167,9 +166,6 @@ module GraphQL
167
166
  mods.each { |mod| new_class.include(mod) }
168
167
  new_class.include(DefaultTraceClass)
169
168
  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
169
  end
174
170
  trace_class_for(:default, build: true)
175
171
  end
@@ -216,11 +212,6 @@ module GraphQL
216
212
  const_set(:DefaultTrace, Class.new(base_class) do
217
213
  include DefaultTraceClass
218
214
  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
215
  else
225
216
  # First, see if the superclass has a custom-defined class for this.
226
217
  # Then, if it doesn't, use this class's default trace
@@ -1118,6 +1109,9 @@ module GraphQL
1118
1109
  }
1119
1110
  end
1120
1111
 
1112
+ # @api private
1113
+ attr_accessor :using_backtrace
1114
+
1121
1115
  # @api private
1122
1116
  def handle_or_reraise(context, err)
1123
1117
  handler = Execution::Errors.find_handler_for(self, err.class)
@@ -1131,6 +1125,10 @@ module GraphQL
1131
1125
  end
1132
1126
  handler[:handler].call(err, obj, args, context, field)
1133
1127
  else
1128
+ if (context[:backtrace] || using_backtrace) && !err.is_a?(GraphQL::ExecutionError)
1129
+ err = GraphQL::Backtrace::TracedError.new(err, context)
1130
+ end
1131
+
1134
1132
  raise err
1135
1133
  end
1136
1134
  end
@@ -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 = if mode
1453
- mode
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)
@@ -27,6 +27,8 @@ module GraphQL
27
27
  # @param max_errors [Integer] Maximum number of errors before aborting validation. Any positive number will limit the number of errors. Defaults to nil for no limit.
28
28
  # @return [Array<Hash>]
29
29
  def validate(query, validate: true, timeout: nil, max_errors: nil)
30
+ errors = nil
31
+ query.current_trace.begin_validate(query, validate)
30
32
  query.current_trace.validate(validate: validate, query: query) do
31
33
  begin_t = Time.now
32
34
  errors = if validate == false
@@ -58,10 +60,13 @@ module GraphQL
58
60
  }
59
61
  end
60
62
  rescue GraphQL::ExecutionError => e
63
+ errors = [e]
61
64
  {
62
65
  remaining_timeout: nil,
63
- errors: [e],
66
+ errors: errors,
64
67
  }
68
+ ensure
69
+ query.current_trace.end_validate(query, validate, errors)
65
70
  end
66
71
 
67
72
  # Invoked when static validation times out.
@@ -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)
@@ -83,7 +83,7 @@ module GraphQL
83
83
  end
84
84
  end
85
85
 
86
- def execute_field_lazy(query:, field:, ast_node:, arguments:, object:)
86
+ def execute_field_lazy(query:, field:, ast_node:, arguments:, object:) # rubocop:disable Development/TraceCallsSuperCop
87
87
  execute_field(query: query, field: field, ast_node: ast_node, arguments: arguments, object: object)
88
88
  end
89
89
 
@@ -5,72 +5,169 @@ require "graphql/tracing/platform_trace"
5
5
  module GraphQL
6
6
  module Tracing
7
7
  module NewRelicTrace
8
- include PlatformTrace
9
-
10
8
  # @param set_transaction_name [Boolean] If true, the GraphQL operation name will be used as the transaction name.
11
9
  # This is not advised if you run more than one query per HTTP request, for example, with `graphql-client` or multiplexing.
12
10
  # It can also be specified per-query with `context[:set_new_relic_transaction_name]`.
13
- def initialize(set_transaction_name: false, **_rest)
11
+ # @param trace_authorized [Boolean] If `false`, skip tracing `authorized?` calls
12
+ # @param trace_resolve_type [Boolean] If `false`, skip tracing `resolve_type?` calls
13
+ def initialize(set_transaction_name: false, trace_authorized: true, trace_resolve_type: true, **_rest)
14
14
  @set_transaction_name = set_transaction_name
15
+ @trace_authorized = trace_authorized
16
+ @trace_resolve_type = trace_resolve_type
17
+ @nr_field_names = Hash.new do |h, field|
18
+ h[field] = "GraphQL/#{field.owner.graphql_name}/#{field.graphql_name}"
19
+ end.compare_by_identity
20
+
21
+ @nr_authorized_names = Hash.new do |h, type|
22
+ h[type] = "GraphQL/Authorized/#{type.graphql_name}"
23
+ end.compare_by_identity
24
+
25
+ @nr_resolve_type_names = Hash.new do |h, type|
26
+ h[type] = "GraphQL/ResolveType/#{type.graphql_name}"
27
+ end.compare_by_identity
28
+
29
+ @nr_source_names = Hash.new do |h, source_inst|
30
+ h[source_inst] = "GraphQL/Source/#{source_inst.class.name}"
31
+ end.compare_by_identity
32
+
33
+ @nr_parse = @nr_validate = @nr_analyze = @nr_execute = nil
34
+ super
35
+ end
36
+
37
+ def begin_parse(query_str)
38
+ @nr_parse = NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: "GraphQL/parse", category: :web)
39
+ super
40
+ end
41
+
42
+ def end_parse(query_str)
43
+ @nr_parse.finish
44
+ super
45
+ end
46
+
47
+ def begin_validate(query, validate)
48
+ @nr_validate = NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: "GraphQL/validate", category: :web)
49
+ super
50
+ end
51
+
52
+ def end_validate(query, validate, validation_errors)
53
+ @nr_validate.finish
54
+ super
55
+ end
56
+
57
+ def begin_analyze_multiplex(multiplex, analyzers)
58
+ @nr_analyze = NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: "GraphQL/analyze", category: :web)
59
+ super
60
+ end
61
+
62
+ def end_analyze_multiplex(multiplex, analyzers)
63
+ @nr_analyze.finish
15
64
  super
16
65
  end
17
66
 
18
- def execute_query(query:)
19
- set_this_txn_name = query.context[:set_new_relic_transaction_name]
20
- if set_this_txn_name == true || (set_this_txn_name.nil? && @set_transaction_name)
67
+ def begin_execute_multiplex(multiplex)
68
+ query = multiplex.queries.first
69
+ set_this_txn_name = query.context[:set_new_relic_transaction_name]
70
+ if set_this_txn_name || (set_this_txn_name.nil? && @set_transaction_name)
21
71
  NewRelic::Agent.set_transaction_name(transaction_name(query))
22
72
  end
23
- NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped("GraphQL/execute") do
24
- super
73
+ @nr_execute = NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: "GraphQL/execute", category: :web)
74
+ super
75
+ end
76
+
77
+ def end_execute_multiplex(multiplex)
78
+ @nr_execute.finish
79
+ super
80
+ end
81
+
82
+ def begin_execute_field(field, object, arguments, query)
83
+ nr_segment_stack << NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: @nr_field_names[field], category: :web)
84
+ super
85
+ end
86
+
87
+ def end_execute_field(field, objects, arguments, query, result)
88
+ nr_segment_stack.pop.finish
89
+ super
90
+ end
91
+
92
+ def begin_authorized(type, obj, ctx)
93
+ if @trace_authorized
94
+ nr_segment_stack << NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: @nr_authorized_names[type], category: :web)
25
95
  end
96
+ super
26
97
  end
27
98
 
28
- {
29
- "lex" => "GraphQL/lex",
30
- "parse" => "GraphQL/parse",
31
- "validate" => "GraphQL/validate",
32
- "analyze_query" => "GraphQL/analyze",
33
- "analyze_multiplex" => "GraphQL/analyze",
34
- "execute_multiplex" => "GraphQL/execute",
35
- "execute_query_lazy" => "GraphQL/execute",
36
- }.each do |trace_method, platform_key|
37
- module_eval <<-RUBY, __FILE__, __LINE__
38
- def #{trace_method}(**_keys)
39
- NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped("#{platform_key}") do
40
- super
41
- end
42
- end
43
- RUBY
44
- end
45
-
46
- def platform_execute_field(platform_key)
47
- NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped(platform_key) do
48
- yield
99
+ def end_authorized(type, obj, ctx, is_authed)
100
+ if @trace_authorized
101
+ nr_segment_stack.pop.finish
49
102
  end
103
+ super
50
104
  end
51
105
 
52
- def platform_authorized(platform_key)
53
- NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped(platform_key) do
54
- yield
106
+ def begin_resolve_type(type, value, context)
107
+ if @trace_resolve_type
108
+ nr_segment_stack << NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: @nr_resolve_type_names[type], category: :web)
55
109
  end
110
+ super
56
111
  end
57
112
 
58
- def platform_resolve_type(platform_key)
59
- NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped(platform_key) do
60
- yield
113
+ def end_resolve_type(type, value, context, resolved_type)
114
+ if @trace_resolve_type
115
+ nr_segment_stack.pop.finish
61
116
  end
117
+ super
62
118
  end
63
119
 
64
- def platform_field_key(field)
65
- "GraphQL/#{field.owner.graphql_name}/#{field.graphql_name}"
120
+ def begin_dataloader(dl)
121
+ super
66
122
  end
67
123
 
68
- def platform_authorized_key(type)
69
- "GraphQL/Authorize/#{type.graphql_name}"
124
+ def end_dataloader(dl)
125
+ super
126
+ end
127
+
128
+ def begin_dataloader_source(source)
129
+ nr_segment_stack << NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: @nr_source_names[source], category: :web)
130
+ super
131
+ end
132
+
133
+ def end_dataloader_source(source)
134
+ nr_segment_stack.pop.finish
135
+ super
136
+ end
137
+
138
+ def dataloader_fiber_yield(source)
139
+ current_segment = nr_segment_stack.last
140
+ current_segment.finish
141
+ super
142
+ end
143
+
144
+ def dataloader_fiber_resume(source)
145
+ prev_segment = nr_segment_stack.pop
146
+ seg_partial_name = prev_segment.name.sub(/^.*(GraphQL.*)$/, '\1')
147
+ nr_segment_stack << NewRelic::Agent::Tracer.start_transaction_or_segment(partial_name: seg_partial_name, category: :web)
148
+ super
149
+ end
150
+
151
+ private
152
+
153
+ def nr_segment_stack
154
+ Fiber[:graphql_nr_segment_stack] ||= []
155
+ end
156
+
157
+ def transaction_name(query)
158
+ selected_op = query.selected_operation
159
+ txn_name = if selected_op
160
+ op_type = selected_op.operation_type
161
+ op_name = selected_op.name || fallback_transaction_name(query.context) || "anonymous"
162
+ "#{op_type}.#{op_name}"
163
+ else
164
+ "query.anonymous"
165
+ end
166
+ "GraphQL/#{txn_name}"
70
167
  end
71
168
 
72
- def platform_resolve_type_key(type)
73
- "GraphQL/ResolveType/#{type.graphql_name}"
169
+ def fallback_transaction_name(context)
170
+ context[:tracing_fallback_transaction_name]
74
171
  end
75
172
  end
76
173
  end
@@ -0,0 +1,141 @@
1
+ // This is an abbreviated version of the full Perfetto schema.
2
+ // Most of them are for OS or Chrome traces and we'll never use them.
3
+ // Full doc: https://github.com/google/perfetto/tree/main/protos/perfetto
4
+ //
5
+ // Build it with
6
+ // protoc --ruby_out=lib/graphql/tracing/perfetto_trace --proto_path=lib/graphql/tracing/perfetto_trace trace.proto
7
+ syntax = "proto2";
8
+ package perfetto_trace.protos;
9
+ option ruby_package = "GraphQL::Tracing::PerfettoTrace";
10
+
11
+ message Trace {
12
+ repeated TracePacket packet = 1;
13
+ }
14
+
15
+ message TracePacket {
16
+ optional uint64 timestamp = 8;
17
+ oneof data {
18
+ TrackEvent track_event = 11;
19
+ TrackDescriptor track_descriptor = 60;
20
+ }
21
+ oneof optional_trusted_packet_sequence_id {
22
+ uint32 trusted_packet_sequence_id = 10;
23
+ }
24
+ optional InternedData interned_data = 12;
25
+ optional bool first_packet_on_sequence = 87;
26
+ optional bool previous_packet_dropped = 42;
27
+ optional uint32 sequence_flags = 13;
28
+ }
29
+
30
+ message TrackEvent {
31
+ repeated uint64 category_iids = 3;
32
+ repeated string categories = 22;
33
+ oneof name_field {
34
+ uint64 name_iid = 10;
35
+ string name = 23;
36
+ }
37
+ enum Type {
38
+ TYPE_UNSPECIFIED = 0;
39
+ TYPE_SLICE_BEGIN = 1;
40
+ TYPE_SLICE_END = 2;
41
+ TYPE_INSTANT = 3;
42
+ TYPE_COUNTER = 4;
43
+ }
44
+ optional Type type = 9;
45
+ optional uint64 track_uuid = 11;
46
+ oneof counter_value_field {
47
+ int64 counter_value = 30;
48
+ double double_counter_value = 44;
49
+ }
50
+ repeated uint64 extra_counter_track_uuids = 31;
51
+ repeated int64 extra_counter_values = 12;
52
+ repeated uint64 extra_double_counter_track_uuids = 45;
53
+ repeated double extra_double_counter_values = 46;
54
+ repeated fixed64 flow_ids = 47;
55
+ repeated fixed64 terminating_flow_ids = 48;
56
+ repeated DebugAnnotation debug_annotations = 4;
57
+ }
58
+
59
+ message DebugAnnotation {
60
+ oneof name_field {
61
+ uint64 name_iid = 1;
62
+ string name = 10;
63
+ }
64
+ oneof value {
65
+ bool bool_value = 2;
66
+ uint64 uint_value = 3;
67
+ int64 int_value = 4;
68
+ double double_value = 5;
69
+ string string_value = 6;
70
+ uint64 string_value_iid = 17;
71
+ }
72
+ repeated DebugAnnotation dict_entries = 11;
73
+ repeated DebugAnnotation array_values = 12;
74
+ uint64 string_value_iid = 17;
75
+ }
76
+
77
+ message TrackDescriptor {
78
+ optional uint64 uuid = 1;
79
+ optional uint64 parent_uuid = 5;
80
+
81
+ oneof static_or_dynamic_name {
82
+ string name = 2;
83
+ }
84
+
85
+ optional CounterDescriptor counter = 8;
86
+ enum ChildTracksOrdering {
87
+ UNKNOWN = 0;
88
+ LEXICOGRAPHIC = 1;
89
+ CHRONOLOGICAL = 2;
90
+ EXPLICIT = 3;
91
+ }
92
+ optional ChildTracksOrdering child_ordering = 11;
93
+ optional int32 sibling_order_rank = 12;
94
+ }
95
+
96
+ message CounterDescriptor {
97
+ enum BuiltinCounterType {
98
+ COUNTER_UNSPECIFIED = 0;
99
+ COUNTER_THREAD_TIME_NS = 1;
100
+ COUNTER_THREAD_INSTRUCTION_COUNT = 2;
101
+ }
102
+ enum Unit {
103
+ UNIT_UNSPECIFIED = 0;
104
+ UNIT_TIME_NS = 1;
105
+ UNIT_COUNT = 2;
106
+ UNIT_SIZE_BYTES = 3;
107
+ }
108
+ optional BuiltinCounterType type = 1;
109
+ repeated string categories = 2;
110
+ optional Unit unit = 3;
111
+ optional string unit_name = 6;
112
+ optional int64 unit_multiplier = 4;
113
+ optional bool is_incremental = 5;
114
+ }
115
+
116
+ message InternedData {
117
+ repeated EventCategory event_categories = 1;
118
+ repeated EventName event_names = 2;
119
+ repeated DebugAnnotationName debug_annotation_names = 3;
120
+ repeated InternedString debug_annotation_string_values = 29;
121
+ }
122
+
123
+ message InternedString {
124
+ optional uint64 iid = 1;
125
+ optional bytes str = 2;
126
+ }
127
+
128
+ message EventCategory {
129
+ optional uint64 iid = 1;
130
+ optional string name = 2;
131
+ }
132
+
133
+ message EventName {
134
+ optional uint64 iid = 1;
135
+ optional string name = 2;
136
+ }
137
+
138
+ message DebugAnnotationName {
139
+ optional uint64 iid = 1;
140
+ optional string name = 2;
141
+ }
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: trace.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+
8
+ descriptor_data = "\n\x0btrace.proto\x12\x15perfetto_trace.protos\";\n\x05Trace\x12\x32\n\x06packet\x18\x01 \x03(\x0b\x32\".perfetto_trace.protos.TracePacket\"\x8a\x03\n\x0bTracePacket\x12\x11\n\ttimestamp\x18\x08 \x01(\x04\x12\x38\n\x0btrack_event\x18\x0b \x01(\x0b\x32!.perfetto_trace.protos.TrackEventH\x00\x12\x42\n\x10track_descriptor\x18< \x01(\x0b\x32&.perfetto_trace.protos.TrackDescriptorH\x00\x12$\n\x1atrusted_packet_sequence_id\x18\n \x01(\rH\x01\x12:\n\rinterned_data\x18\x0c \x01(\x0b\x32#.perfetto_trace.protos.InternedData\x12 \n\x18\x66irst_packet_on_sequence\x18W \x01(\x08\x12\x1f\n\x17previous_packet_dropped\x18* \x01(\x08\x12\x16\n\x0esequence_flags\x18\r \x01(\rB\x06\n\x04\x64\x61taB%\n#optional_trusted_packet_sequence_id\"\xf2\x04\n\nTrackEvent\x12\x15\n\rcategory_iids\x18\x03 \x03(\x04\x12\x12\n\ncategories\x18\x16 \x03(\t\x12\x12\n\x08name_iid\x18\n \x01(\x04H\x00\x12\x0e\n\x04name\x18\x17 \x01(\tH\x00\x12\x34\n\x04type\x18\t \x01(\x0e\x32&.perfetto_trace.protos.TrackEvent.Type\x12\x12\n\ntrack_uuid\x18\x0b \x01(\x04\x12\x17\n\rcounter_value\x18\x1e \x01(\x03H\x01\x12\x1e\n\x14\x64ouble_counter_value\x18, \x01(\x01H\x01\x12!\n\x19\x65xtra_counter_track_uuids\x18\x1f \x03(\x04\x12\x1c\n\x14\x65xtra_counter_values\x18\x0c \x03(\x03\x12(\n extra_double_counter_track_uuids\x18- \x03(\x04\x12#\n\x1b\x65xtra_double_counter_values\x18. \x03(\x01\x12\x10\n\x08\x66low_ids\x18/ \x03(\x06\x12\x1c\n\x14terminating_flow_ids\x18\x30 \x03(\x06\x12\x41\n\x11\x64\x65\x62ug_annotations\x18\x04 \x03(\x0b\x32&.perfetto_trace.protos.DebugAnnotation\"j\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x14\n\x10TYPE_SLICE_BEGIN\x10\x01\x12\x12\n\x0eTYPE_SLICE_END\x10\x02\x12\x10\n\x0cTYPE_INSTANT\x10\x03\x12\x10\n\x0cTYPE_COUNTER\x10\x04\x42\x0c\n\nname_fieldB\x15\n\x13\x63ounter_value_field\"\xd5\x02\n\x0f\x44\x65\x62ugAnnotation\x12\x12\n\x08name_iid\x18\x01 \x01(\x04H\x00\x12\x0e\n\x04name\x18\n \x01(\tH\x00\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x01\x12\x14\n\nuint_value\x18\x03 \x01(\x04H\x01\x12\x13\n\tint_value\x18\x04 \x01(\x03H\x01\x12\x16\n\x0c\x64ouble_value\x18\x05 \x01(\x01H\x01\x12\x16\n\x0cstring_value\x18\x06 \x01(\tH\x01\x12\x1a\n\x10string_value_iid\x18\x11 \x01(\x04H\x01\x12<\n\x0c\x64ict_entries\x18\x0b \x03(\x0b\x32&.perfetto_trace.protos.DebugAnnotation\x12<\n\x0c\x61rray_values\x18\x0c \x03(\x0b\x32&.perfetto_trace.protos.DebugAnnotationB\x0c\n\nname_fieldB\x07\n\x05value\"\xe1\x02\n\x0fTrackDescriptor\x12\x0c\n\x04uuid\x18\x01 \x01(\x04\x12\x13\n\x0bparent_uuid\x18\x05 \x01(\x04\x12\x0e\n\x04name\x18\x02 \x01(\tH\x00\x12\x39\n\x07\x63ounter\x18\x08 \x01(\x0b\x32(.perfetto_trace.protos.CounterDescriptor\x12R\n\x0e\x63hild_ordering\x18\x0b \x01(\x0e\x32:.perfetto_trace.protos.TrackDescriptor.ChildTracksOrdering\x12\x1a\n\x12sibling_order_rank\x18\x0c \x01(\x05\"V\n\x13\x43hildTracksOrdering\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x11\n\rLEXICOGRAPHIC\x10\x01\x12\x11\n\rCHRONOLOGICAL\x10\x02\x12\x0c\n\x08\x45XPLICIT\x10\x03\x42\x18\n\x16static_or_dynamic_name\"\xb9\x03\n\x11\x43ounterDescriptor\x12I\n\x04type\x18\x01 \x01(\x0e\x32;.perfetto_trace.protos.CounterDescriptor.BuiltinCounterType\x12\x12\n\ncategories\x18\x02 \x03(\t\x12;\n\x04unit\x18\x03 \x01(\x0e\x32-.perfetto_trace.protos.CounterDescriptor.Unit\x12\x11\n\tunit_name\x18\x06 \x01(\t\x12\x17\n\x0funit_multiplier\x18\x04 \x01(\x03\x12\x16\n\x0eis_incremental\x18\x05 \x01(\x08\"o\n\x12\x42uiltinCounterType\x12\x17\n\x13\x43OUNTER_UNSPECIFIED\x10\x00\x12\x1a\n\x16\x43OUNTER_THREAD_TIME_NS\x10\x01\x12$\n COUNTER_THREAD_INSTRUCTION_COUNT\x10\x02\"S\n\x04Unit\x12\x14\n\x10UNIT_UNSPECIFIED\x10\x00\x12\x10\n\x0cUNIT_TIME_NS\x10\x01\x12\x0e\n\nUNIT_COUNT\x10\x02\x12\x13\n\x0fUNIT_SIZE_BYTES\x10\x03\"\xa0\x02\n\x0cInternedData\x12>\n\x10\x65vent_categories\x18\x01 \x03(\x0b\x32$.perfetto_trace.protos.EventCategory\x12\x35\n\x0b\x65vent_names\x18\x02 \x03(\x0b\x32 .perfetto_trace.protos.EventName\x12J\n\x16\x64\x65\x62ug_annotation_names\x18\x03 \x03(\x0b\x32*.perfetto_trace.protos.DebugAnnotationName\x12M\n\x1e\x64\x65\x62ug_annotation_string_values\x18\x1d \x03(\x0b\x32%.perfetto_trace.protos.InternedString\"*\n\x0eInternedString\x12\x0b\n\x03iid\x18\x01 \x01(\x04\x12\x0b\n\x03str\x18\x02 \x01(\x0c\"*\n\rEventCategory\x12\x0b\n\x03iid\x18\x01 \x01(\x04\x12\x0c\n\x04name\x18\x02 \x01(\t\"&\n\tEventName\x12\x0b\n\x03iid\x18\x01 \x01(\x04\x12\x0c\n\x04name\x18\x02 \x01(\t\"0\n\x13\x44\x65\x62ugAnnotationName\x12\x0b\n\x03iid\x18\x01 \x01(\x04\x12\x0c\n\x04name\x18\x02 \x01(\tB\"\xea\x02\x1fGraphQL::Tracing::PerfettoTrace"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
12
+
13
+ module GraphQL
14
+ module Tracing
15
+ module PerfettoTrace
16
+ Trace = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.Trace").msgclass
17
+ TracePacket = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.TracePacket").msgclass
18
+ TrackEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.TrackEvent").msgclass
19
+ TrackEvent::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.TrackEvent.Type").enummodule
20
+ DebugAnnotation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.DebugAnnotation").msgclass
21
+ TrackDescriptor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.TrackDescriptor").msgclass
22
+ TrackDescriptor::ChildTracksOrdering = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.TrackDescriptor.ChildTracksOrdering").enummodule
23
+ CounterDescriptor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.CounterDescriptor").msgclass
24
+ CounterDescriptor::BuiltinCounterType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.CounterDescriptor.BuiltinCounterType").enummodule
25
+ CounterDescriptor::Unit = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.CounterDescriptor.Unit").enummodule
26
+ InternedData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.InternedData").msgclass
27
+ InternedString = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.InternedString").msgclass
28
+ EventCategory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.EventCategory").msgclass
29
+ EventName = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.EventName").msgclass
30
+ DebugAnnotationName = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("perfetto_trace.protos.DebugAnnotationName").msgclass
31
+ end
32
+ end
33
+ end