graphql-metrics 5.0.5 → 5.0.6
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/CHANGELOG.md +4 -0
- data/lib/graphql/metrics/trace.rb +18 -9
- data/lib/graphql/metrics/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efe8bea1e59d9020f597627aedf1cde1735d6c2558c5910e3e818e5bf7cab6ff
|
4
|
+
data.tar.gz: e28a49b6e546eaa55cb4d8e3b34ad2a81d4ea4b5c7c3edd62f300206d84ff3b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19aa99f9ee90e7af56f762890fab216cabb01d73775b49caa98c896add21272b6f83d149d379df1ee10d5644527bce17e7c8cad7650a411d001684815c1c2cdb
|
7
|
+
data.tar.gz: 0de176edaa686d33f5b8de7986353d64a9b1e80a11293808ae333ecd46f5bd531baa1c871374b297280b0550fc2a791783ddf371e92be55ed21b921a54790ac7
|
data/CHANGELOG.md
CHANGED
@@ -5,8 +5,9 @@ module GraphQL
|
|
5
5
|
module Trace
|
6
6
|
def initialize(**_rest)
|
7
7
|
super
|
8
|
-
|
9
|
-
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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,
|
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.
|
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-
|
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.
|
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: []
|