graphql-metrics 5.0.5 → 5.0.6

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: 9f93d51a57f59de189c9b97ad3f0f26eee049c3ec1af8dc77951cb3e892558f8
4
- data.tar.gz: 62531e77262446959b6309c57a34e29313d8c006af3acbd2a9b74b02888d78d7
3
+ metadata.gz: efe8bea1e59d9020f597627aedf1cde1735d6c2558c5910e3e818e5bf7cab6ff
4
+ data.tar.gz: e28a49b6e546eaa55cb4d8e3b34ad2a81d4ea4b5c7c3edd62f300206d84ff3b1
5
5
  SHA512:
6
- metadata.gz: 3b8782d2b3ffe8891f2f54e8554b8c3f1e121090fd74525f64ae38730a1bc4d277f0fa8a4bf7d7ae5e33258edae3e6f31351a1bf897507a92de828fcde5854a7
7
- data.tar.gz: 16aa581d6b9073dbd6ca0db8ebada56c6d4af05e74e4f78ac0d20577768068f5f39b620860bfc4cb2470da1825dee9a0f25f8a26ec4e1dddaf8c22e1867ef8c4
6
+ metadata.gz: 19aa99f9ee90e7af56f762890fab216cabb01d73775b49caa98c896add21272b6f83d149d379df1ee10d5644527bce17e7c8cad7650a411d001684815c1c2cdb
7
+ data.tar.gz: 0de176edaa686d33f5b8de7986353d64a9b1e80a11293808ae333ecd46f5bd531baa1c871374b297280b0550fc2a791783ddf371e92be55ed21b921a54790ac7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 5.0.6
2
+ -----
3
+ - [74](https://github.com/Shopify/graphql-metrics/pull/74) Fix skip_tracing compatibility with new Tracing API
4
+
1
5
  5.0.5
2
6
  -----
3
7
  - [73](https://github.com/Shopify/graphql-metrics/pull/73) Fix calls to other traces.
@@ -5,8 +5,9 @@ module GraphQL
5
5
  module Trace
6
6
  def initialize(**_rest)
7
7
  super
8
- context = (@multiplex || @query).context
9
- @skip_tracing = context&.fetch(GraphQL::Metrics::SKIP_GRAPHQL_METRICS_ANALYSIS, false)
8
+
9
+ query_or_multiplex = @query || @multiplex
10
+ @skip_tracing = query_or_multiplex.context&.fetch(SKIP_GRAPHQL_METRICS_ANALYSIS, false) if query_or_multiplex
10
11
  end
11
12
 
12
13
  # NOTE: These methods come from the graphql ruby gem and are in "chronological" order based on the phases
@@ -16,7 +17,7 @@ module GraphQL
16
17
 
17
18
  # wraps everything below this line; only run once
18
19
  def execute_multiplex(multiplex:)
19
- return super if @skip_tracing
20
+ return super if skip_tracing?(multiplex)
20
21
  capture_multiplex_start_time { super }
21
22
  end
22
23
 
@@ -33,13 +34,13 @@ module GraphQL
33
34
  end
34
35
 
35
36
  def validate(query:, validate:)
36
- return super if @skip_tracing
37
+ return super if skip_tracing?(query)
37
38
  capture_validation_time(query.context) { super }
38
39
  end
39
40
 
40
41
  # wraps all `analyze_query`s; only run once
41
42
  def analyze_multiplex(multiplex:)
42
- return super if @skip_tracing
43
+ return super if skip_tracing?(multiplex)
43
44
  # Ensures that we reset potentially long-lived PreContext objects between multiplexs. We reset at this point
44
45
  # since all parsing and validation will be done by this point, and a GraphQL::Query::Context will exist.
45
46
  pre_context.reset
@@ -47,29 +48,37 @@ module GraphQL
47
48
  end
48
49
 
49
50
  def analyze_query(query:)
50
- return super if @skip_tracing
51
+ return super if skip_tracing?(query)
51
52
  capture_analysis_time(query.context) { super }
52
53
  end
53
54
 
54
55
  def execute_query(query:)
55
- return super if @skip_tracing
56
+ return super if skip_tracing?(query)
56
57
  capture_query_start_time(query.context) { super }
57
58
  end
58
59
 
59
60
  def execute_field(field:, query:, ast_node:, arguments:, object:)
60
- return super if @skip_tracing || query.context[SKIP_FIELD_AND_ARGUMENT_METRICS]
61
+ return super if skip_tracing?(query) || query.context[SKIP_FIELD_AND_ARGUMENT_METRICS]
61
62
  return super unless GraphQL::Metrics.timings_capture_enabled?(query.context)
62
63
  trace_field(GraphQL::Metrics::INLINE_FIELD_TIMINGS, query) { super }
63
64
  end
64
65
 
65
66
  def execute_field_lazy(field:, query:, ast_node:, arguments:, object:)
66
- return super if @skip_tracing || query.context[SKIP_FIELD_AND_ARGUMENT_METRICS]
67
+ return super if skip_tracing?(query) || query.context[SKIP_FIELD_AND_ARGUMENT_METRICS]
67
68
  return super unless GraphQL::Metrics.timings_capture_enabled?(query.context)
68
69
  trace_field(GraphQL::Metrics::LAZY_FIELD_TIMINGS, query) { super }
69
70
  end
70
71
 
71
72
  private
72
73
 
74
+ def skip_tracing?(query_or_multiplex)
75
+ if !defined?(@skip_tracing)
76
+ @skip_tracing = query_or_multiplex.context&.fetch(SKIP_GRAPHQL_METRICS_ANALYSIS, false)
77
+ end
78
+
79
+ @skip_tracing
80
+ end
81
+
73
82
  PreContext = Struct.new(
74
83
  :multiplex_start_time,
75
84
  :multiplex_start_time_monotonic,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module Metrics
5
- VERSION = "5.0.5"
5
+ VERSION = "5.0.6"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5
4
+ version: 5.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Butcher
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-10 00:00:00.000000000 Z
11
+ date: 2023-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -230,7 +230,7 @@ homepage: https://github.com/Shopify/graphql-metrics
230
230
  licenses:
231
231
  - MIT
232
232
  metadata: {}
233
- post_install_message:
233
+ post_install_message:
234
234
  rdoc_options: []
235
235
  require_paths:
236
236
  - lib
@@ -245,8 +245,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  - !ruby/object:Gem::Version
246
246
  version: '0'
247
247
  requirements: []
248
- rubygems_version: 3.0.3.1
249
- signing_key:
248
+ rubygems_version: 3.3.3
249
+ signing_key:
250
250
  specification_version: 4
251
251
  summary: GraphQL Metrics Extractor
252
252
  test_files: []