opentelemetry-instrumentation-graphql 0.21.1 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6933e85196eaf2f0f93f7c8d86e7713c0d56fecb2035eded886357c7c2d9579b
4
- data.tar.gz: f6d5f32f7c34453c7effc96a97451c75ccefe259b3d1ff2ea89616fd09353902
3
+ metadata.gz: 5015100d46cc0f99c590360df33781cc842d904c34bac8bb03775bcb92034211
4
+ data.tar.gz: 16dae74e81ea06bc994c0f974a963be0daed52a209b4db2dc6c2388f6e8f88be
5
5
  SHA512:
6
- metadata.gz: 6e680d4a2f2e8d8b5c0dc9b011dd38fbb289b4c5c82af79b19ed5a4a415367fd8df8be013cfee0e69cca4d5b53a7066c2aeaa9063ef8b29798d58bb43792cf05
7
- data.tar.gz: 925f99580cdf0eeaa21a5f9613df6d7a6722ae774a6284b7b31e93915829da959857741a8104d1573a649691af839e80bc8276bd3352e631830ce7a03007f810
6
+ metadata.gz: 4afdb500fe0423832111b88a75554bb271ba5c478a4dbd7786c054e8110b69cb2f0903f1198a0fc90cf76c9d5b51a5a2bb24054ce0d54069b51a61f299acaa52
7
+ data.tar.gz: bdd7284be3c68c61791735fe2ab695dccc74a926a4bc2d91ca322330cb96716056093cf7b27f3037df45cfac7660bf8e19f6e94aec5e2c65cc7eef48550ef939
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-instrumentation-graphql
2
2
 
3
+ ### v0.22.0 / 2023-01-27
4
+
5
+ * ADDED: Normalize GraphQL span names for easier aggregation analysis
6
+
3
7
  ### v0.21.1 / 2023-01-14
4
8
 
5
9
  * DOCS: Fix gem homepage
data/README.md CHANGED
@@ -40,7 +40,12 @@ OpenTelemetry::SDK.configure do |c|
40
40
  # enable_platform_authorized maps to the authorized and authorized_lazy keys
41
41
  enable_platform_authorized: false,
42
42
  # enable_platform_resolve_type maps to the resolve_type and resolve_type_lazy keys
43
- enable_platform_resolve_type: false
43
+ enable_platform_resolve_type: false,
44
+
45
+ # Controls if platform tracing (field/authorized/resolve_type)
46
+ # should use the legacy span names (e.g. "MyType.myField") or the
47
+ # new normalized span names (e.g. "graphql.execute_field").
48
+ legacy_platform_span_names: false
44
49
  }
45
50
  end
46
51
  ```
@@ -35,6 +35,11 @@ module OpenTelemetry
35
35
  # The enable_platform_resolve_type key expects a boolean value,
36
36
  # and enables the tracing of "resolve_type" and "resolve_type_lazy".
37
37
  #
38
+ # The legacy_platform_span_names key expects a boolean value,
39
+ # and controls if platform tracing (field/authorized/resolve_type)
40
+ # should use the legacy span names (e.g. "MyType.myField") or the
41
+ # new normalized span names (e.g. "graphql.execute_field").
42
+ #
38
43
  # The schemas key expects an array of Schemas, and is used to specify
39
44
  # which schemas are to be instrumented. If this value is not supplied
40
45
  # the default behaviour is to instrument all schemas.
@@ -42,6 +47,7 @@ module OpenTelemetry
42
47
  option :enable_platform_field, default: false, validate: :boolean
43
48
  option :enable_platform_authorized, default: false, validate: :boolean
44
49
  option :enable_platform_resolve_type, default: false, validate: :boolean
50
+ option :legacy_platform_span_names, default: false, validate: :boolean
45
51
 
46
52
  private
47
53
 
@@ -45,19 +45,31 @@ module OpenTelemetry
45
45
  def platform_field_key(type, field)
46
46
  return unless config[:enable_platform_field]
47
47
 
48
- "#{type.graphql_name}.#{field.graphql_name}"
48
+ if config[:legacy_platform_span_names]
49
+ "#{type.graphql_name}.#{field.graphql_name}"
50
+ else
51
+ 'graphql.execute_field'
52
+ end
49
53
  end
50
54
 
51
55
  def platform_authorized_key(type)
52
56
  return unless config[:enable_platform_authorized]
53
57
 
54
- "#{type.graphql_name}.authorized"
58
+ if config[:legacy_platform_span_names]
59
+ "#{type.graphql_name}.authorized"
60
+ else
61
+ 'graphql.authorized'
62
+ end
55
63
  end
56
64
 
57
65
  def platform_resolve_type_key(type)
58
66
  return unless config[:enable_platform_resolve_type]
59
67
 
60
- "#{type.graphql_name}.resolve_type"
68
+ if config[:legacy_platform_span_names]
69
+ "#{type.graphql_name}.resolve_type"
70
+ else
71
+ 'graphql.resolve_type'
72
+ end
61
73
  end
62
74
 
63
75
  private
@@ -70,9 +82,19 @@ module OpenTelemetry
70
82
  GraphQL::Instrumentation.instance.config
71
83
  end
72
84
 
73
- def attributes_for(key, data)
85
+ def attributes_for(key, data) # rubocop:disable Metrics/CyclomaticComplexity
74
86
  attributes = {}
75
87
  case key
88
+ when 'execute_field', 'execute_field_lazy'
89
+ attributes['graphql.field.parent'] = data[:owner]&.graphql_name # owner is the concrete type, not interface
90
+ attributes['graphql.field.name'] = data[:field]&.graphql_name
91
+ attributes['graphql.lazy'] = key == 'execute_field_lazy'
92
+ when 'authorized', 'authorized_lazy'
93
+ attributes['graphql.type.name'] = data[:type]&.graphql_name
94
+ attributes['graphql.lazy'] = key == 'authorized_lazy'
95
+ when 'resolve_type', 'resolve_type_lazy'
96
+ attributes['graphql.type.name'] = data[:type]&.graphql_name
97
+ attributes['graphql.lazy'] = key == 'resolve_type_lazy'
76
98
  when 'execute_query'
77
99
  attributes['graphql.operation.name'] = data[:query].selected_operation_name if data[:query].selected_operation_name
78
100
  attributes['graphql.operation.type'] = data[:query].selected_operation.operation_type
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module GraphQL
10
- VERSION = '0.21.1'
10
+ VERSION = '0.22.0'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.1
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-14 00:00:00.000000000 Z
11
+ date: 2023-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -233,10 +233,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
233
233
  licenses:
234
234
  - Apache-2.0
235
235
  metadata:
236
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-graphql/0.21.1/file/CHANGELOG.md
236
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-graphql/0.22.0/file/CHANGELOG.md
237
237
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/graphql
238
238
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
239
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-graphql/0.21.1
239
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-graphql/0.22.0
240
240
  post_install_message:
241
241
  rdoc_options: []
242
242
  require_paths: