graphql-metrics 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +17 -17
- data/.ruby-version +1 -1
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/gemfiles/graphql_1.13.gemfile +5 -0
- data/gemfiles/graphql_2.0.gemfile +5 -0
- data/lib/graphql/metrics/tracer.rb +10 -12
- data/lib/graphql/metrics/version.rb +1 -1
- metadata +8 -7
- data/service.yml +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a593fd22527d995c8b1561e714ac905b03fa60f6974b216ec7bab8a23abdb68
|
4
|
+
data.tar.gz: d08fff1f3519497dbf44e3fad6e3c4276f7d3ab5ac824ec2ea49623390b7e986
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ea9bbb51fa4f87f150656418931d2331ba3c957d3952e51e0b71e2b7bb837af362775731bb6cd1b6357fb46030781285a02b17a042870965ca2ced3caecc08
|
7
|
+
data.tar.gz: bd1442eb545d3e8f90d9c22397a82fac2bf518a1f3395571f1563da5587cf38d8e9af09ade053bcf96b99a8aeb06eed84b2e7fc93589f38ad354bf141eea835a
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
name:
|
2
|
-
|
3
|
-
on: [push]
|
4
|
-
|
1
|
+
name: Tests
|
2
|
+
on: [push, pull_request]
|
5
3
|
jobs:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
test:
|
5
|
+
strategy:
|
6
|
+
fail-fast: false
|
7
|
+
matrix:
|
8
|
+
os: [ubuntu-latest]
|
9
|
+
ruby: ['2.7', '3.0', '3.1', '3.2']
|
10
|
+
gemfile: ['graphql_1.13', 'graphql_2.0']
|
11
|
+
runs-on: ${{ matrix.os }}
|
12
|
+
env:
|
13
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
10
14
|
steps:
|
11
|
-
- uses: actions/checkout@
|
12
|
-
-
|
13
|
-
uses: actions/setup-ruby@v1
|
15
|
+
- uses: actions/checkout@v3
|
16
|
+
- uses: ruby/setup-ruby@v1
|
14
17
|
with:
|
15
|
-
ruby-version:
|
16
|
-
|
17
|
-
|
18
|
-
gem install bundler
|
19
|
-
bundle install --jobs 4 --retry 3
|
20
|
-
bundle exec rake test
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
bundler-cache: true
|
20
|
+
- run: bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
3.2.0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
![](https://github.com/Shopify/graphql-metrics/workflows/Ruby/badge.svg)
|
4
4
|
|
5
|
-
Extract as much
|
5
|
+
Extract as much detail as you want from GraphQL queries, served up from your Ruby app and the [`graphql` gem](https://github.com/rmosolgo/graphql-ruby).
|
6
6
|
Compatible with the [`graphql-batch` gem](https://github.com/Shopify/graphql-batch), to extract batch-loaded fields resolution timings.
|
7
7
|
|
8
8
|
Be sure to read the [CHANGELOG](CHANGELOG.md) to stay updated on feature additions, breaking changes made to this gem.
|
@@ -93,10 +93,7 @@ module GraphQL
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def capture_lexing_time
|
96
|
-
|
97
|
-
# `pre_context.multiplex_start_time_monotonic` isn't set.
|
98
|
-
lexing_offset_time = pre_context.multiplex_start_time_monotonic || GraphQL::Metrics.current_time_monotonic
|
99
|
-
timed_result = GraphQL::Metrics.time(lexing_offset_time) { yield }
|
96
|
+
timed_result = GraphQL::Metrics.time { yield }
|
100
97
|
|
101
98
|
pre_context.lexing_start_time_offset = timed_result.start_time
|
102
99
|
pre_context.lexing_duration = timed_result.duration
|
@@ -105,10 +102,7 @@ module GraphQL
|
|
105
102
|
end
|
106
103
|
|
107
104
|
def capture_parsing_time
|
108
|
-
|
109
|
-
# `pre_context.multiplex_start_time_monotonic` isn't set.
|
110
|
-
parsing_offset_time = pre_context.multiplex_start_time_monotonic || GraphQL::Metrics.current_time_monotonic
|
111
|
-
timed_result = GraphQL::Metrics.time(parsing_offset_time) { yield }
|
105
|
+
timed_result = GraphQL::Metrics.time { yield }
|
112
106
|
|
113
107
|
pre_context.parsing_start_time_offset = timed_result.start_time
|
114
108
|
pre_context.parsing_duration = timed_result.duration
|
@@ -166,17 +160,21 @@ module GraphQL
|
|
166
160
|
|
167
161
|
def trace_field(context_key, data)
|
168
162
|
ns = data[:query].context.namespace(CONTEXT_NAMESPACE)
|
169
|
-
|
163
|
+
offset_time = ns[GraphQL::Metrics::QUERY_START_TIME_MONOTONIC]
|
164
|
+
start_time = GraphQL::Metrics.current_time_monotonic
|
170
165
|
|
171
|
-
|
166
|
+
result = yield
|
167
|
+
|
168
|
+
duration = GraphQL::Metrics.current_time_monotonic - start_time
|
169
|
+
time_since_offset = start_time - offset_time if offset_time
|
172
170
|
|
173
171
|
path_excluding_numeric_indicies = data[:path].select { |p| p.is_a?(String) }
|
174
172
|
ns[context_key][path_excluding_numeric_indicies] ||= []
|
175
173
|
ns[context_key][path_excluding_numeric_indicies] << {
|
176
|
-
start_time_offset:
|
174
|
+
start_time_offset: time_since_offset, duration: duration
|
177
175
|
}
|
178
176
|
|
179
|
-
|
177
|
+
result
|
180
178
|
end
|
181
179
|
end
|
182
180
|
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.
|
4
|
+
version: 5.0.1
|
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:
|
11
|
+
date: 2023-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -215,18 +215,19 @@ files:
|
|
215
215
|
- Rakefile
|
216
216
|
- bin/console
|
217
217
|
- bin/setup
|
218
|
+
- gemfiles/graphql_1.13.gemfile
|
219
|
+
- gemfiles/graphql_2.0.gemfile
|
218
220
|
- graphql_metrics.gemspec
|
219
221
|
- lib/graphql/metrics.rb
|
220
222
|
- lib/graphql/metrics/analyzer.rb
|
221
223
|
- lib/graphql/metrics/instrumentation.rb
|
222
224
|
- lib/graphql/metrics/tracer.rb
|
223
225
|
- lib/graphql/metrics/version.rb
|
224
|
-
- service.yml
|
225
226
|
homepage: https://github.com/Shopify/graphql-metrics
|
226
227
|
licenses:
|
227
228
|
- MIT
|
228
229
|
metadata: {}
|
229
|
-
post_install_message:
|
230
|
+
post_install_message:
|
230
231
|
rdoc_options: []
|
231
232
|
require_paths:
|
232
233
|
- lib
|
@@ -241,8 +242,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
242
|
- !ruby/object:Gem::Version
|
242
243
|
version: '0'
|
243
244
|
requirements: []
|
244
|
-
rubygems_version: 3.
|
245
|
-
signing_key:
|
245
|
+
rubygems_version: 3.3.3
|
246
|
+
signing_key:
|
246
247
|
specification_version: 4
|
247
248
|
summary: GraphQL Metrics Extractor
|
248
249
|
test_files: []
|
data/service.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
classification: library
|