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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e2e02bf92da34c67af89cf112efe2525ca4a785f4f9169dd35320c687f5f9f4
4
- data.tar.gz: 4ec1a5b37180e5e7be02934992347053d3d4a4d2f03866975600577704e141a1
3
+ metadata.gz: 6a593fd22527d995c8b1561e714ac905b03fa60f6974b216ec7bab8a23abdb68
4
+ data.tar.gz: d08fff1f3519497dbf44e3fad6e3c4276f7d3ab5ac824ec2ea49623390b7e986
5
5
  SHA512:
6
- metadata.gz: 213906efdd58b32a7cab558028fc96de33c9624f9e85ffbb572954486bb31bebc7e718f0aee4e6df4f7324d5c99c6cc1849d13a54e43bef1963a3b55517796e1
7
- data.tar.gz: 4f6309cc4cdbe2244be1d744173f795df04e955af9cef6d52111f1181c074cece01dcf226ebe20a545f3f2d41306b5eb5226e4d90ec1a7ece70656707982934a
6
+ metadata.gz: 90ea9bbb51fa4f87f150656418931d2331ba3c957d3952e51e0b71e2b7bb837af362775731bb6cd1b6357fb46030781285a02b17a042870965ca2ced3caecc08
7
+ data.tar.gz: bd1442eb545d3e8f90d9c22397a82fac2bf518a1f3395571f1563da5587cf38d8e9af09ade053bcf96b99a8aeb06eed84b2e7fc93589f38ad354bf141eea835a
@@ -1,20 +1,20 @@
1
- name: Ruby
2
-
3
- on: [push]
4
-
1
+ name: Tests
2
+ on: [push, pull_request]
5
3
  jobs:
6
- build:
7
-
8
- runs-on: ubuntu-latest
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@v1
12
- - name: Set up Ruby 2.6
13
- uses: actions/setup-ruby@v1
15
+ - uses: actions/checkout@v3
16
+ - uses: ruby/setup-ruby@v1
14
17
  with:
15
- ruby-version: 2.6.x
16
- - name: Build and test with Rake
17
- run: |
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.6.5
1
+ 3.2.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ 5.0.1
2
+ -----
3
+ - [63](https://github.com/Shopify/graphql-metrics/pull/63) Eliminate `TimedResult` objects for `trace_field`.
1
4
  5.0.0
2
5
  -----
3
6
  - [50](https://github.com/Shopify/graphql-metrics/pull/50) Capture metrics for directives and their arguments.
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 much detail as you want from GraphQL queries, served up from your Ruby app and the [`graphql` gem](https://github.com/rmosolgo/graphql-ruby).
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.
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ eval_gemfile("../Gemfile")
4
+
5
+ gem("graphql", "~> 1.13")
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ eval_gemfile("../Gemfile")
4
+
5
+ gem("graphql", "~> 2.0")
@@ -93,10 +93,7 @@ module GraphQL
93
93
  end
94
94
 
95
95
  def capture_lexing_time
96
- # GraphQL::Query#result fires `lex` before the `execute_multiplex` event, so sometimes
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
- # GraphQL::Query#result fires `parse` before the `execute_multiplex` event, so sometimes
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
- query_start_time_monotonic = ns[GraphQL::Metrics::QUERY_START_TIME_MONOTONIC]
163
+ offset_time = ns[GraphQL::Metrics::QUERY_START_TIME_MONOTONIC]
164
+ start_time = GraphQL::Metrics.current_time_monotonic
170
165
 
171
- timed_result = GraphQL::Metrics.time(query_start_time_monotonic) { yield }
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: timed_result.time_since_offset, duration: timed_result.duration
174
+ start_time_offset: time_since_offset, duration: duration
177
175
  }
178
176
 
179
- timed_result.result
177
+ result
180
178
  end
181
179
  end
182
180
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module Metrics
5
- VERSION = "5.0.0"
5
+ VERSION = "5.0.1"
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.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: 2021-06-24 00:00:00.000000000 Z
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.0.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