yabeda-graphql 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +12 -0
- data/Appraisals +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +70 -0
- data/LICENSE.txt +21 -0
- data/README.md +73 -0
- data/Rakefile +6 -0
- data/bin/console +10 -0
- data/bin/setup +8 -0
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/graphql_1.10.gemfile +14 -0
- data/gemfiles/graphql_1.10.gemfile.lock +71 -0
- data/gemfiles/graphql_1.9.gemfile +14 -0
- data/gemfiles/graphql_1.9.gemfile.lock +71 -0
- data/lib/yabeda/graphql.rb +31 -0
- data/lib/yabeda/graphql/tracing.rb +96 -0
- data/lib/yabeda/graphql/version.rb +5 -0
- data/yabeda-graphql.gemspec +33 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2e6f15447f058d31396f82fafe18a97fa19a24fcf0f1d672d9ae06155f49e2e1
|
4
|
+
data.tar.gz: 3770f253aa4a2fe2bf44abfdc43f87a77d051389e7116b20ffff0c8301556b46
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bb025e9085107b5c675d644fdc26aa05775cd4c6ca9b6a73f192d4f385c5564644107d6cd731489f25f7b33bad451241b123f1abd4d0aff9429dbc3b3e2cbfb3
|
7
|
+
data.tar.gz: 84554428c3bbf59ba2d56a467628c50c43d838f7774d84f601d9e3a8d5e2c92a987ed7852dc28b34e5bc806206334279d3846a1996180b181fc57ce58dd5e61f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Appraisals
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
yabeda-graphql (0.1.0)
|
5
|
+
graphql (~> 1.9)
|
6
|
+
yabeda (~> 0.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
appraisal (2.2.0)
|
12
|
+
bundler
|
13
|
+
rake
|
14
|
+
thor (>= 0.14.0)
|
15
|
+
byebug (11.1.1)
|
16
|
+
coderay (1.1.2)
|
17
|
+
concurrent-ruby (1.1.6)
|
18
|
+
diff-lcs (1.3)
|
19
|
+
dry-initializer (3.0.3)
|
20
|
+
graphql (1.10.5)
|
21
|
+
graphql-batch (0.4.2)
|
22
|
+
graphql (>= 1.3, < 2)
|
23
|
+
promise.rb (~> 0.7.2)
|
24
|
+
method_source (0.9.2)
|
25
|
+
promise.rb (0.7.4)
|
26
|
+
pry (0.12.2)
|
27
|
+
coderay (~> 1.1.0)
|
28
|
+
method_source (~> 0.9.0)
|
29
|
+
pry-byebug (3.8.0)
|
30
|
+
byebug (~> 11.0)
|
31
|
+
pry (~> 0.10)
|
32
|
+
pry-inline (1.0.5)
|
33
|
+
pry (> 0.10.0, <= 0.12.2)
|
34
|
+
unicode (~> 0.4.4)
|
35
|
+
rake (13.0.1)
|
36
|
+
rspec (3.9.0)
|
37
|
+
rspec-core (~> 3.9.0)
|
38
|
+
rspec-expectations (~> 3.9.0)
|
39
|
+
rspec-mocks (~> 3.9.0)
|
40
|
+
rspec-core (3.9.1)
|
41
|
+
rspec-support (~> 3.9.1)
|
42
|
+
rspec-expectations (3.9.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.9.0)
|
45
|
+
rspec-mocks (3.9.1)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.9.0)
|
48
|
+
rspec-support (3.9.2)
|
49
|
+
thor (1.0.1)
|
50
|
+
unicode (0.4.4.4)
|
51
|
+
yabeda (0.5.0)
|
52
|
+
concurrent-ruby
|
53
|
+
dry-initializer
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
appraisal
|
60
|
+
bundler
|
61
|
+
graphql-batch
|
62
|
+
pry
|
63
|
+
pry-byebug
|
64
|
+
pry-inline
|
65
|
+
rake (~> 13.0)
|
66
|
+
rspec (~> 3.0)
|
67
|
+
yabeda-graphql!
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Andrey Novikov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Yabeda::[GraphQL][GraphQL-Ruby]
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/yabeda-rb/yabeda-graphql.svg?branch=master)](https://travis-ci.org/yabeda-rb/yabeda-graphql)
|
4
|
+
|
5
|
+
Built-in metrics for [GraphQL-Ruby] monitoring out of the box! Part of the [yabeda] suite.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
1. Add the gem to your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'yabeda-graphql'
|
13
|
+
|
14
|
+
# Then add monitoring system adapter, e.g.:
|
15
|
+
# gem 'yabeda-prometheus'
|
16
|
+
|
17
|
+
# If you're using Railsm don't forget to add plugin for it:
|
18
|
+
# gem 'yabeda-rails'
|
19
|
+
# But if not then you should run `Yabeda.configure!` manually when your app is ready.
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
```sh
|
25
|
+
bundle install
|
26
|
+
```
|
27
|
+
|
28
|
+
2. Hook it to your schema:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
class YourAppSchema < GraphQL::Schema
|
32
|
+
use Yabeda::GraphQL::Tracing, trace_scalars: true
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
3. And deploy it!
|
37
|
+
|
38
|
+
**And that is it!** GraphQL metrics are being collected!
|
39
|
+
|
40
|
+
## Metrics
|
41
|
+
|
42
|
+
- **Fields resolved count**: `graphql_fields_request_count` (segmented by `type` name, `field` name and `deprecated` flag)
|
43
|
+
- **Field resolve runtime**: `graphql_field_resolve_runtime` (segmented by `type` name, `field` name and `deprecated` flag)
|
44
|
+
- **Queries executed count** (root query fields): `query_fields_count` (segmented by query `name` and `deprecated` flag)
|
45
|
+
- **Mutations executed** (root mutation fields): `mutation_fields_count` (segmented by query `name` and `deprecated` flag)
|
46
|
+
|
47
|
+
That is it for now, but more will come later.
|
48
|
+
|
49
|
+
## Development
|
50
|
+
|
51
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
52
|
+
|
53
|
+
Then, run fololowing commands to run the tests against all supported versions of [GraphQL-Ruby]:
|
54
|
+
|
55
|
+
```sh
|
56
|
+
GRAPHQL_RUBY_INTERPRETER=yes bundle exec appraisal rspec
|
57
|
+
GRAPHQL_RUBY_INTERPRETER=no bundle exec appraisal rspec
|
58
|
+
```
|
59
|
+
|
60
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
61
|
+
|
62
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-graphql.
|
67
|
+
|
68
|
+
## License
|
69
|
+
|
70
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
71
|
+
|
72
|
+
[yabeda]: https://github.com/yabeda-rb/yabeda "Extendable framework for collecting and exporting metrics from your Ruby application"
|
73
|
+
[GraphQL-Ruby]: https://graphql-ruby.org/ "Ruby implementation of GraphQL"
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "yabeda/graphql"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
require "pry"
|
10
|
+
Pry.start
|
data/bin/setup
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "graphql", "~> 1.10.0"
|
6
|
+
|
7
|
+
group :development, :test do
|
8
|
+
gem "pry"
|
9
|
+
gem "pry-inline"
|
10
|
+
gem "pry-byebug", platform: :mri
|
11
|
+
gem "graphql-batch"
|
12
|
+
end
|
13
|
+
|
14
|
+
gemspec path: "../"
|
@@ -0,0 +1,71 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
yabeda-graphql (0.1.0)
|
5
|
+
graphql (~> 1.9)
|
6
|
+
yabeda (~> 0.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
appraisal (2.2.0)
|
12
|
+
bundler
|
13
|
+
rake
|
14
|
+
thor (>= 0.14.0)
|
15
|
+
byebug (11.1.1)
|
16
|
+
coderay (1.1.2)
|
17
|
+
concurrent-ruby (1.1.6)
|
18
|
+
diff-lcs (1.3)
|
19
|
+
dry-initializer (3.0.3)
|
20
|
+
graphql (1.10.5)
|
21
|
+
graphql-batch (0.4.2)
|
22
|
+
graphql (>= 1.3, < 2)
|
23
|
+
promise.rb (~> 0.7.2)
|
24
|
+
method_source (0.9.2)
|
25
|
+
promise.rb (0.7.4)
|
26
|
+
pry (0.12.2)
|
27
|
+
coderay (~> 1.1.0)
|
28
|
+
method_source (~> 0.9.0)
|
29
|
+
pry-byebug (3.8.0)
|
30
|
+
byebug (~> 11.0)
|
31
|
+
pry (~> 0.10)
|
32
|
+
pry-inline (1.0.5)
|
33
|
+
pry (> 0.10.0, <= 0.12.2)
|
34
|
+
unicode (~> 0.4.4)
|
35
|
+
rake (13.0.1)
|
36
|
+
rspec (3.9.0)
|
37
|
+
rspec-core (~> 3.9.0)
|
38
|
+
rspec-expectations (~> 3.9.0)
|
39
|
+
rspec-mocks (~> 3.9.0)
|
40
|
+
rspec-core (3.9.1)
|
41
|
+
rspec-support (~> 3.9.1)
|
42
|
+
rspec-expectations (3.9.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.9.0)
|
45
|
+
rspec-mocks (3.9.1)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.9.0)
|
48
|
+
rspec-support (3.9.2)
|
49
|
+
thor (1.0.1)
|
50
|
+
unicode (0.4.4.4)
|
51
|
+
yabeda (0.5.0)
|
52
|
+
concurrent-ruby
|
53
|
+
dry-initializer
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
appraisal
|
60
|
+
bundler
|
61
|
+
graphql (~> 1.10.0)
|
62
|
+
graphql-batch
|
63
|
+
pry
|
64
|
+
pry-byebug
|
65
|
+
pry-inline
|
66
|
+
rake (~> 13.0)
|
67
|
+
rspec (~> 3.0)
|
68
|
+
yabeda-graphql!
|
69
|
+
|
70
|
+
BUNDLED WITH
|
71
|
+
2.1.4
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "graphql", "~> 1.9.0"
|
6
|
+
|
7
|
+
group :development, :test do
|
8
|
+
gem "pry"
|
9
|
+
gem "pry-inline"
|
10
|
+
gem "pry-byebug", platform: :mri
|
11
|
+
gem "graphql-batch"
|
12
|
+
end
|
13
|
+
|
14
|
+
gemspec path: "../"
|
@@ -0,0 +1,71 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
yabeda-graphql (0.1.0)
|
5
|
+
graphql (~> 1.9)
|
6
|
+
yabeda (~> 0.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
appraisal (2.2.0)
|
12
|
+
bundler
|
13
|
+
rake
|
14
|
+
thor (>= 0.14.0)
|
15
|
+
byebug (11.1.1)
|
16
|
+
coderay (1.1.2)
|
17
|
+
concurrent-ruby (1.1.6)
|
18
|
+
diff-lcs (1.3)
|
19
|
+
dry-initializer (3.0.3)
|
20
|
+
graphql (1.9.19)
|
21
|
+
graphql-batch (0.4.2)
|
22
|
+
graphql (>= 1.3, < 2)
|
23
|
+
promise.rb (~> 0.7.2)
|
24
|
+
method_source (0.9.2)
|
25
|
+
promise.rb (0.7.4)
|
26
|
+
pry (0.12.2)
|
27
|
+
coderay (~> 1.1.0)
|
28
|
+
method_source (~> 0.9.0)
|
29
|
+
pry-byebug (3.8.0)
|
30
|
+
byebug (~> 11.0)
|
31
|
+
pry (~> 0.10)
|
32
|
+
pry-inline (1.0.5)
|
33
|
+
pry (> 0.10.0, <= 0.12.2)
|
34
|
+
unicode (~> 0.4.4)
|
35
|
+
rake (13.0.1)
|
36
|
+
rspec (3.9.0)
|
37
|
+
rspec-core (~> 3.9.0)
|
38
|
+
rspec-expectations (~> 3.9.0)
|
39
|
+
rspec-mocks (~> 3.9.0)
|
40
|
+
rspec-core (3.9.1)
|
41
|
+
rspec-support (~> 3.9.1)
|
42
|
+
rspec-expectations (3.9.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.9.0)
|
45
|
+
rspec-mocks (3.9.1)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.9.0)
|
48
|
+
rspec-support (3.9.2)
|
49
|
+
thor (1.0.1)
|
50
|
+
unicode (0.4.4.4)
|
51
|
+
yabeda (0.5.0)
|
52
|
+
concurrent-ruby
|
53
|
+
dry-initializer
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
appraisal
|
60
|
+
bundler
|
61
|
+
graphql (~> 1.9.0)
|
62
|
+
graphql-batch
|
63
|
+
pry
|
64
|
+
pry-byebug
|
65
|
+
pry-inline
|
66
|
+
rake (~> 13.0)
|
67
|
+
rspec (~> 3.0)
|
68
|
+
yabeda-graphql!
|
69
|
+
|
70
|
+
BUNDLED WITH
|
71
|
+
2.1.4
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "yabeda"
|
2
|
+
require "yabeda/graphql/version"
|
3
|
+
require "yabeda/graphql/tracing"
|
4
|
+
|
5
|
+
module Yabeda
|
6
|
+
module GraphQL
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
REQUEST_BUCKETS = [
|
10
|
+
0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10,
|
11
|
+
].freeze
|
12
|
+
|
13
|
+
Yabeda.configure do
|
14
|
+
group :graphql
|
15
|
+
|
16
|
+
histogram :field_resolve_runtime, comment: "A histogram of field resolving time",
|
17
|
+
unit: :seconds, per: :field,
|
18
|
+
tags: %i[type field deprecated],
|
19
|
+
buckets: REQUEST_BUCKETS
|
20
|
+
|
21
|
+
counter :fields_request_count, comment: "A counter for specific fields requests",
|
22
|
+
tags: %i[type field deprecated]
|
23
|
+
|
24
|
+
counter :query_fields_count, comment: "A counter for query root fields",
|
25
|
+
tags: %i[name deprecated]
|
26
|
+
|
27
|
+
counter :mutation_fields_count, comment: "A counter for mutation root fields",
|
28
|
+
tags: %i[name deprecated]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require "graphql/tracing/platform_tracing"
|
2
|
+
|
3
|
+
module Yabeda
|
4
|
+
module GraphQL
|
5
|
+
class Tracing < ::GraphQL::Tracing::PlatformTracing
|
6
|
+
|
7
|
+
self.platform_keys = {
|
8
|
+
'lex' => "graphql.lex",
|
9
|
+
'parse' => "graphql.parse",
|
10
|
+
'validate' => "graphql.validate",
|
11
|
+
'analyze_query' => "graphql.analyze",
|
12
|
+
'analyze_multiplex' => "graphql.analyze",
|
13
|
+
'execute_multiplex' => "graphql.execute",
|
14
|
+
'execute_query' => "graphql.execute",
|
15
|
+
'execute_query_lazy' => "graphql.execute",
|
16
|
+
'execute_field' => "graphql.execute",
|
17
|
+
'execute_field_lazy' => "graphql.execute"
|
18
|
+
}
|
19
|
+
|
20
|
+
def platform_trace(platform_key, key, data, &block)
|
21
|
+
start = ::Process.clock_gettime ::Process::CLOCK_MONOTONIC
|
22
|
+
result = block.call
|
23
|
+
duration = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start
|
24
|
+
|
25
|
+
case key
|
26
|
+
when "execute_field", "execute_field_lazy"
|
27
|
+
field, path, query = extract_field_trace_data(data)
|
28
|
+
|
29
|
+
return result if key == "execute_field" && query.schema.lazy?(result)
|
30
|
+
|
31
|
+
tags = extract_field_tags(field)
|
32
|
+
if path.length == 1
|
33
|
+
if query.query?
|
34
|
+
instrument_query_execution(tags)
|
35
|
+
elsif query.mutation?
|
36
|
+
instrument_mutation_execution(tags)
|
37
|
+
elsif query.subscription?
|
38
|
+
# Not implemented yet
|
39
|
+
end
|
40
|
+
else
|
41
|
+
instrument_field_execution(tags, duration)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
result
|
46
|
+
end
|
47
|
+
|
48
|
+
# See https://graphql-ruby.org/api-doc/1.10.5/GraphQL/Tracing
|
49
|
+
def extract_field_trace_data(data)
|
50
|
+
if data[:context] # Legacy non-interpreter mode
|
51
|
+
[data[:context].field, data[:context].path, data[:context].query]
|
52
|
+
else # Interpreter mode
|
53
|
+
data.values_at(:field, :path, :query)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def extract_field_tags(field)
|
58
|
+
owner = field.respond_to?(:owner) ? field.owner : field.metadata[:type_class].owner
|
59
|
+
{
|
60
|
+
type: owner.graphql_name,
|
61
|
+
field: field.graphql_name,
|
62
|
+
deprecated: !field.deprecation_reason.nil?,
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def instrument_field_execution(tags, duration)
|
67
|
+
Yabeda.graphql.field_resolve_runtime.measure(tags, duration)
|
68
|
+
Yabeda.graphql.fields_request_count.increment(tags)
|
69
|
+
end
|
70
|
+
|
71
|
+
def instrument_mutation_execution(tags)
|
72
|
+
tags = { name: tags[:field], deprecated: tags[:deprecated] }
|
73
|
+
Yabeda.graphql.mutation_fields_count.increment(tags)
|
74
|
+
end
|
75
|
+
|
76
|
+
def instrument_query_execution(tags)
|
77
|
+
tags = { name: tags[:field], deprecated: tags[:deprecated] }
|
78
|
+
Yabeda.graphql.query_fields_count.increment(tags)
|
79
|
+
end
|
80
|
+
|
81
|
+
def platform_field_key(type, field)
|
82
|
+
"#{type.graphql_name}.#{field.graphql_name}"
|
83
|
+
end
|
84
|
+
|
85
|
+
# We don't use these yet, but graphql-ruby require us to declare them
|
86
|
+
|
87
|
+
def platform_authorized_key(type)
|
88
|
+
"#{type.graphql_name}.authorized"
|
89
|
+
end
|
90
|
+
|
91
|
+
def platform_resolve_type_key(type)
|
92
|
+
"#{type.graphql_name}.resolve_type"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative 'lib/yabeda/graphql/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "yabeda-graphql"
|
5
|
+
spec.version = Yabeda::GraphQL::VERSION
|
6
|
+
spec.authors = ["Andrey Novikov"]
|
7
|
+
spec.email = ["envek@envek.name"]
|
8
|
+
|
9
|
+
spec.summary = %q{Collects metrics to monitor execution of your GraphQL queries}
|
10
|
+
spec.description = %q{Extends Yabeda metrics with graphql-ruby metrics: queries, mutations, fields…}
|
11
|
+
spec.homepage = "http://github.com/yabeda-rb/yabeda-graphql"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_runtime_dependency "yabeda", "~> 0.2"
|
27
|
+
spec.add_runtime_dependency "graphql", "~> 1.9"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler"
|
30
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
spec.add_development_dependency "appraisal"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yabeda-graphql
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrey Novikov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yabeda
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: graphql
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.9'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '13.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '13.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: appraisal
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: 'Extends Yabeda metrics with graphql-ruby metrics: queries, mutations,
|
98
|
+
fields…'
|
99
|
+
email:
|
100
|
+
- envek@envek.name
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Appraisals
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- bin/console
|
115
|
+
- bin/setup
|
116
|
+
- gemfiles/.bundle/config
|
117
|
+
- gemfiles/graphql_1.10.gemfile
|
118
|
+
- gemfiles/graphql_1.10.gemfile.lock
|
119
|
+
- gemfiles/graphql_1.9.gemfile
|
120
|
+
- gemfiles/graphql_1.9.gemfile.lock
|
121
|
+
- lib/yabeda/graphql.rb
|
122
|
+
- lib/yabeda/graphql/tracing.rb
|
123
|
+
- lib/yabeda/graphql/version.rb
|
124
|
+
- yabeda-graphql.gemspec
|
125
|
+
homepage: http://github.com/yabeda-rb/yabeda-graphql
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata:
|
129
|
+
homepage_uri: http://github.com/yabeda-rb/yabeda-graphql
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.3.0
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubygems_version: 3.1.2
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Collects metrics to monitor execution of your GraphQL queries
|
149
|
+
test_files: []
|