graphql-metrics 1.1.2 → 1.1.5

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
  SHA1:
3
- metadata.gz: 245c973caa0e704220cc9b2363543758171de916
4
- data.tar.gz: 0200a7fbbaa3ce77f5f564ee8649ee22a1c9a498
3
+ metadata.gz: 95309c5ed04f9b4c10fe700e9e013ff19d3be644
4
+ data.tar.gz: 3318e036297987653dae4fc03f28100537426fac
5
5
  SHA512:
6
- metadata.gz: 1077c5445ffa0052f6d8570acd44717550aa09de861461f24f8edd0b55c7eb7d87493fc463b94313f3499ae9b56015e4cfdc3cdd9e876beea7d2b6714569a3ea
7
- data.tar.gz: fbc1aea880d0e801334706ddcf39b188d33d26827f856d8bc0f8bdcab04a096b6fc9c9265fa133a01f14075a57e0f2cedba740f1784da58ad9b05d0bfcfbdd0e
6
+ metadata.gz: 95f17afd63cdd64624abee5c8f7595c65bd7c5b0e034a38e36b2b7d64cbb7f2582b6cee4a83ee5e7b58a30c6d977b8a6c2c5d7e1e025dd95197ef16cd59fc8e6
7
+ data.tar.gz: 177ecdbc69be67a2c7c04463689b4878d66860282d2664abd91abac000af38979a9e994a4f4a87c2ecd53e370c36ef5d77aff77470646c0046aba13fec27b786
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql-metrics (1.1.2)
4
+ graphql-metrics (1.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,6 +11,7 @@ GEM
11
11
  i18n (>= 0.7, < 2)
12
12
  minitest (~> 5.1)
13
13
  tzinfo (~> 1.1)
14
+ byebug (10.0.2)
14
15
  coderay (1.1.2)
15
16
  concurrent-ruby (1.0.5)
16
17
  diffy (3.2.1)
@@ -31,6 +32,9 @@ GEM
31
32
  pry (0.11.3)
32
33
  coderay (~> 1.1.0)
33
34
  method_source (~> 0.9.0)
35
+ pry-byebug (3.6.0)
36
+ byebug (~> 10.0)
37
+ pry (~> 0.10)
34
38
  rake (10.5.0)
35
39
  redis (4.0.1)
36
40
  thread_safe (0.3.6)
@@ -51,6 +55,7 @@ DEPENDENCIES
51
55
  minitest (~> 5.0)
52
56
  mocha
53
57
  pry
58
+ pry-byebug
54
59
  rake
55
60
 
56
61
  BUNDLED WITH
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # GraphQL Metrics Extractor
2
2
 
3
- Extract as much much detail as you want from GraphQL queries, served up from your Ruby app and the `graphql` gem.
4
- Compatible with the `graphql-batch` gem, to extract batch-loaded fields resolution timings.
3
+ [![Build Status](https://travis-ci.org/Shopify/graphql-metrics.svg?branch=master)](https://travis-ci.org/Shopify/graphql-metrics)
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).
6
+ Compatible with the [`graphql-batch` gem](https://github.com/Shopify/graphql-batch), to extract batch-loaded fields resolution timings.
5
7
 
6
8
  ## Installation
7
9
 
@@ -11,6 +13,16 @@ Add this line to your application's Gemfile:
11
13
  gem 'graphql-metrics'
12
14
  ```
13
15
 
16
+ You can require it with in your code as needed with:
17
+ ```ruby
18
+ require 'graphql_metrics'
19
+ ```
20
+
21
+ Or globally in the Gemfile with:
22
+ ```ruby
23
+ gem 'graphql-metrics', require: 'graphql_metrics'
24
+ ```
25
+
14
26
  And then execute:
15
27
 
16
28
  $ bundle
@@ -44,53 +56,53 @@ Here's an example of a simple extractor that logs out all GraphQL query details.
44
56
  class LoggingExtractor < GraphQLMetrics::Extractor
45
57
  def query_extracted(metrics, _metadata)
46
58
  Rails.logger.debug({
47
- query_string: metrics[:query_string],
48
- operation_type: metrics[:operation_type],
49
- operation_name: metrics[:operation_name],
50
- duration: metrics[:duration]
59
+ query_string: metrics[:query_string], # "query Project { project(name: "GraphQL") { tagline } }"
60
+ operation_type: metrics[:operation_type], # "query"
61
+ operation_name: metrics[:operation_name], # "Project"
62
+ duration: metrics[:duration] # 0.1
51
63
  })
52
64
  end
53
65
 
54
66
  def field_extracted(metrics, _metadata)
55
67
  Rails.logger.debug({
56
- type_name: metrics[:type_name],
57
- field_name: metrics[:field_name],
58
- deprecated: metrics[:deprecated],
59
- resolver_times: metrics[:resolver_times],
68
+ type_name: metrics[:type_name], # "QueryRoot"
69
+ field_name: metrics[:field_name], # "project"
70
+ deprecated: metrics[:deprecated], # false
71
+ resolver_times: metrics[:resolver_times], # [0.1]
60
72
  })
61
73
  end
62
74
 
63
- # NOTE: Applicaable only if you set `use GraphQL::Batch, executor_class: GraphQLMetrics::TimedBatchExecutor`
75
+ # NOTE: Applicable only if you set `use GraphQL::Batch, executor_class: GraphQLMetrics::TimedBatchExecutor`
64
76
  # in your schema.
65
77
  def batch_loaded_field_extracted(metrics, _metadata)
66
78
  Rails.logger.debug({
67
- key: metrics[:key],
68
- identifiers: metrics[:identifiers],
69
- times: metrics[:times],
70
- perform_queue_sizes: metrics[:perform_queue_sizes],
79
+ key: metrics[:key], # "CommentLoader/Comment"
80
+ identifiers: metrics[:identifiers], # "Comment/_/string/_/symbol/Class/?"
81
+ times: metrics[:times], # [0.1, 0.2, 4]
82
+ perform_queue_sizes: metrics[:perform_queue_sizes], # [3]
71
83
  })
72
84
  end
73
85
 
74
86
  def argument_extracted(metrics, _metadata)
75
87
  Rails.logger.debug({
76
- name: metrics[:name],
77
- type: metrics[:type],
78
- value_is_null: metrics[:value_is_null],
79
- default_used: metrics[:default_used],
80
- parent_input_type: metrics[:parent_input_type],
81
- field_name: metrics[:field_name],
82
- field_base_type: metrics[:field_base_type],
88
+ name: metrics[:name], # "post"
89
+ type: metrics[:type], # "postInput"
90
+ value_is_null: metrics[:value_is_null], # false
91
+ default_used: metrics[:default_used], # false
92
+ parent_input_type: metrics[:parent_input_type], # "PostInput"
93
+ field_name: metrics[:field_name], # "postCreate"
94
+ field_base_type: metrics[:field_base_type], # "MutationRoot"
83
95
  })
84
96
  end
85
97
 
86
98
  def variable_extracted(metrics, _metadata)
87
99
  Rails.logger.debug({
88
- operation_name: metrics[:operation_name],
89
- unwrapped_type_name: metrics[:unwrapped_type_name],
90
- type: metrics[:type],
91
- default_value_type: metrics[:default_value_type],
92
- provided_value: metrics[:provided_value],
93
- default_used: metrics[:default_used],
100
+ operation_name: metrics[:operation_name], # "MyMutation"
101
+ unwrapped_type_name: metrics[:unwrapped_type_name], # "PostInput"
102
+ type: metrics[:type], # "PostInput!"
103
+ default_value_type: metrics[:default_value_type], # "IMPLICIT_NULL"
104
+ provided_value: metrics[:provided_value], # false
105
+ default_used: metrics[:default_used], # false
94
106
  })
95
107
  end
96
108
 
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.add_development_dependency "graphql", "~> 1.8.2"
41
41
  spec.add_development_dependency "activesupport", "~> 5.1.5"
42
42
  spec.add_development_dependency "pry"
43
+ spec.add_development_dependency "pry-byebug"
43
44
  spec.add_development_dependency "mocha"
44
45
  spec.add_development_dependency "diffy"
45
46
  spec.add_development_dependency "fakeredis"
@@ -250,7 +250,7 @@ module GraphQLMetrics
250
250
  extract_field(irep_node)
251
251
  extract_arguments(irep_node)
252
252
 
253
- irep_node.typed_children.each_value do |children|
253
+ irep_node.scoped_children.each_value do |children|
254
254
  children.each_value do |child_irep_node|
255
255
  extract_node(child_irep_node)
256
256
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphQLMetrics
4
- VERSION = "1.1.2"
4
+ VERSION = "1.1.5"
5
5
  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: 1.1.2
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Butcher
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-08 00:00:00.000000000 Z
11
+ date: 2018-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: mocha
113
127
  requirement: !ruby/object:Gem::Requirement