graphql-hive 0.1.1 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07376f19ffa9683acd9915b1110922fcf802e21eef2b98be11bdaaf9fac30ba7
4
- data.tar.gz: 18979f799df3a8edd50244c9d9b1c62895b25fbeccd8e9f1245a552da6b6878b
3
+ metadata.gz: 734441600a775933bd1250151b0234b7b8293d4ee49e087a86f80684fe116e74
4
+ data.tar.gz: fe27f880db8cd0d75856fd8586363b6913f445feac2b7f7041a245eb03f49270
5
5
  SHA512:
6
- metadata.gz: b36fb877de650e2df40ea5b34cf5f62eb69930fe40123b4bf24036aead8c6c377714c0fa4a5605bb8db6d182596b3bb95c176cf57254a1029139223e62d2946c
7
- data.tar.gz: 67663762c7c1f853ebb651d84a4ddba6aabf7cda456a755de614e5e2f5ad3d7cd0a5eec0536377f9ac1a94def1609cbab7426725488bf3322eb8b21ecae1ba5b
6
+ metadata.gz: 967bd101bad2140070d198d8b98ae92e4cb7a2716d4709c30b33862683ea35b7b3970c6c32f8727b57619698e7af43c039e79747d5f46a931ef345c2b44d54a7
7
+ data.tar.gz: 9013380ae8c596b015571cc05cf0430658d984ee548c9fb21cc3d423d2a3b7459c298816dc765c053f33a49e41318916d665fd77aa4c5eae0a76fc5d7c81f1f6
@@ -0,0 +1,59 @@
1
+ name: Benchmark
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - master
6
+
7
+ jobs:
8
+ benchmarks:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout Repository
12
+ uses: actions/checkout@v3
13
+
14
+ - name: Use Node
15
+ uses: actions/setup-node@master
16
+ with:
17
+ node-version: 14
18
+ cache: 'yarn'
19
+ cache-dependency-path: 'k6/yarn.lock'
20
+
21
+ - name: Use Ruby
22
+ uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
23
+ with:
24
+ working-directory: ./k6/graphql-api
25
+ ruby-version: 2.6
26
+ bundler-cache: true
27
+
28
+ - name: Start GraphQL API with hive enabled
29
+ working-directory: ./k6/graphql-api
30
+ run: |
31
+ bundle
32
+ bundle exec puma -t 0:1 -p 9292 & sleep 5
33
+ env:
34
+ HIVE_ENABLED: 'true'
35
+
36
+ - name: Start GraphQL API with hive disabled
37
+ working-directory: ./k6/graphql-api
38
+ run: |
39
+ bundle
40
+ bundle exec puma -t 0:1 -p 9291 & sleep 5
41
+ env:
42
+ HIVE_ENABLED: 'false'
43
+
44
+ - name: Start Fake Usage API
45
+ working-directory: ./k6/
46
+ run: |
47
+ yarn
48
+ node usage-api.js & sleep 5s
49
+
50
+ - name: Setup K6
51
+ run: |
52
+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
53
+ echo "deb https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
54
+ sudo apt-get update
55
+ sudo apt-get install k6=0.37.0
56
+
57
+ - name: Start and Report Benchmark
58
+ working-directory: ./k6/
59
+ run: k6 -e GITHUB_PR=${{ github.event.number }} -e GITHUB_SHA=${{ github.sha }} -e GITHUB_TOKEN=${{secrets.GH_PA_TOKEN}} run k6.js
@@ -1,6 +1,11 @@
1
1
  name: CI
2
2
  on:
3
- - pull_request
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ branches:
8
+ - master
4
9
 
5
10
  jobs:
6
11
  rubocop:
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  *.gem
13
+ k6/node_modules/
data/.rubocop.yml CHANGED
@@ -3,6 +3,7 @@ AllCops:
3
3
  NewCops: enable
4
4
  Exclude:
5
5
  - 'examples/**/*'
6
+ - 'k6/**/*'
6
7
  - 'gemfiles/**/*'
7
8
  - 'tmp/**/*'
8
9
  - 'vendor/**/*'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql-hive (0.1.0)
4
+ graphql-hive (0.1.4)
5
5
  graphql (~> 2.0.9)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # GraphQL Hive: `graphql-ruby` integration
1
+ # GraphQL Hive: `graphql-ruby` integration
2
+ [![CI Suite](https://github.com/charlypoly/graphql-ruby-hive/actions/workflows/ci.yml/badge.svg)](https://github.com/charlypoly/graphql-ruby-hive/actions)
3
+ [![Gem Version](https://badge.fury.io/rb/graphql-hive.svg)](https://rubygems.org/gems/graphql-hive)
2
4
 
3
5
  <p align="center">
4
6
  <img src="cover.png" width="500" alt="GraphQL Hive" />
@@ -8,8 +10,8 @@
8
10
 
9
11
  [GraphQL Hive](https://graphql-hive.com/) provides all the tools to get visibility of your GraphQL architecture at all stages, from standalone APIs to composed schemas (Federation, Stitching):
10
12
  - **Schema Registry** with custom breaking changes detection
11
- - **Monitoring** of RPM, latency, error rate and more
12
- - **Integrations** with your favorite tools (Slack, Github Actions and more)
13
+ - **Monitoring** of RPM, latency, error rate, and more
14
+ - **Integrations** with your favorite tools (Slack, Github Actions, and more)
13
15
 
14
16
 
15
17
  <br/>
@@ -137,8 +139,10 @@ end
137
139
 
138
140
  **A note on `buffer_size` and performances**
139
141
 
140
- The `graphql-hive` usage reporter, responsible for sending the operations data to Hive, is running in a separate `Thread` to avoid any major impact on your GraphQL API performances.
142
+ The `graphql-hive` usage reporter, responsible for sending the operations data to Hive, is running in a separate `Thread` to avoid any significant impact on your GraphQL API performances.
143
+
144
+ The performance overhead (with the default `buffer_size` option) is around 1% and [is constantly evaluated for new PR](https://github.com/charlypoly/graphql-ruby-hive/actions/workflows/benchmark.yml).
141
145
 
142
146
  If your GraphQL API has a high RPM, we encourage you to increase the `buffer_size` value.
143
147
 
144
- However, please note that a higher `buffer_size` value will introduce some peak of increase of memory comsumption.
148
+ However, please note that a higher `buffer_size` value will introduce some peak of increase in memory consumption.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- graphql-hive (0.1.0)
4
+ graphql-hive (0.1.4)
5
5
  graphql (~> 2.0.9)
6
6
 
7
7
  GEM
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'graphql'
4
+ gem 'graphql-hive', path: '../../'
5
+ gem 'puma'
6
+ gem 'rack-contrib'
7
+ gem 'sinatra'
8
+ gem 'sinatra-contrib'
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ graphql-hive (0.1.3)
5
+ graphql (~> 2.0.9)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ graphql (2.0.9)
11
+ multi_json (1.15.0)
12
+ mustermann (1.1.1)
13
+ ruby2_keywords (~> 0.0.1)
14
+ nio4r (2.5.8)
15
+ puma (5.6.4)
16
+ nio4r (~> 2.0)
17
+ rack (2.2.3.1)
18
+ rack-contrib (2.3.0)
19
+ rack (~> 2.0)
20
+ rack-protection (2.2.0)
21
+ rack
22
+ ruby2_keywords (0.0.5)
23
+ sinatra (2.2.0)
24
+ mustermann (~> 1.0)
25
+ rack (~> 2.2)
26
+ rack-protection (= 2.2.0)
27
+ tilt (~> 2.0)
28
+ sinatra-contrib (2.2.0)
29
+ multi_json
30
+ mustermann (~> 1.0)
31
+ rack-protection (= 2.2.0)
32
+ sinatra (= 2.2.0)
33
+ tilt (~> 2.0)
34
+ tilt (2.0.10)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ graphql
41
+ graphql-hive!
42
+ puma
43
+ rack-contrib
44
+ sinatra
45
+ sinatra-contrib
46
+
47
+ BUNDLED WITH
48
+ 1.17.3
@@ -0,0 +1,22 @@
1
+ require 'sinatra'
2
+ require 'sinatra/json'
3
+ require 'rack/contrib'
4
+
5
+ require_relative 'schema'
6
+
7
+ class DemoApp < Sinatra::Base
8
+ use Rack::JSONBodyParser
9
+
10
+ post '/graphql' do
11
+ result = Schema.execute(
12
+ params['query'],
13
+ variables: params[:variables],
14
+ operation_name: params[:operationName],
15
+ context: {
16
+ client_name: 'GraphQL Client',
17
+ client_version: '1.0'
18
+ }
19
+ )
20
+ json result
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ require './app'
2
+ run DemoApp
@@ -0,0 +1,35 @@
1
+ require 'graphql'
2
+ require 'graphql-hive'
3
+
4
+ module Types
5
+ class PostType < GraphQL::Schema::Object
6
+ description 'A blog post'
7
+ field :id, ID, null: false
8
+ field :title, String, null: false
9
+ # fields should be queried in camel-case (this will be `truncatedPreview`)
10
+ field :truncated_preview, String, null: false
11
+ end
12
+ end
13
+
14
+ class QueryType < GraphQL::Schema::Object
15
+ description 'The query root of this schema'
16
+
17
+ # First describe the field signature:
18
+ field :post, Types::PostType, 'Find a post by ID' do
19
+ argument :id, [ID]
20
+ end
21
+
22
+ # Then provide an implementation:
23
+ def post(id:)
24
+ { id: 1, title: 'GraphQL Hive with `graphql-ruby`',
25
+ truncated_preview: 'Monitor operations, inspect your queries and publish your GraphQL schema with GraphQL Hive' }
26
+ end
27
+ end
28
+
29
+ class Schema < GraphQL::Schema
30
+ query QueryType
31
+
32
+ use(GraphQL::Hive,
33
+ { enabled: ENV['HIVE_ENABLED'] === 'true', endpoint: 'localhost', debug: true, port: 8888, token: 'stress-token',
34
+ report_schema: false })
35
+ end
data/k6/k6.js ADDED
@@ -0,0 +1,99 @@
1
+ import { check } from "k6";
2
+ import http from "k6/http";
3
+ import { textSummary } from "https://jslib.k6.io/k6-summary/0.0.1/index.js";
4
+ import { githubComment } from "https://raw.githubusercontent.com/dotansimha/k6-github-pr-comment/master/lib.js";
5
+
6
+ export const options = {
7
+ discardResponseBodies: true,
8
+ scenarios: {
9
+ hiveEnabled: {
10
+ executor: "shared-iterations",
11
+ vus: 120,
12
+ iterations: 500,
13
+ maxDuration: "30s",
14
+ env: { GQL_API_PORT: "9292", HIVE_ENABLED: "true" },
15
+ },
16
+ hiveDisabled: {
17
+ executor: "shared-iterations",
18
+ vus: 120,
19
+ iterations: 500,
20
+ maxDuration: "30s",
21
+ startTime: "30s",
22
+ env: { GQL_API_PORT: "9291", HIVE_ENABLED: "false" },
23
+ },
24
+ },
25
+ thresholds: {
26
+ "http_req_duration{hive:enabled}": ["avg<4500"],
27
+ "http_req_duration{hive:disabled}": ["avg<4500"],
28
+ },
29
+ };
30
+
31
+ const QUERY = /* GraphQL */ `
32
+ query GetPost {
33
+ post(id: 1) {
34
+ title
35
+ myId: id
36
+ }
37
+ }
38
+ `;
39
+
40
+ export default function () {
41
+ const payload = JSON.stringify({
42
+ query: QUERY,
43
+ operationName: "GetPost",
44
+ });
45
+ const params = {
46
+ headers: {
47
+ "Content-Type": "application/json",
48
+ },
49
+ tags: { hive: __ENV.HIVE_ENABLED === "true" ? "enabled" : "disabled" },
50
+ };
51
+
52
+ return http.post(
53
+ `http://localhost:${__ENV.GQL_API_PORT}/graphql`,
54
+ payload,
55
+ params
56
+ );
57
+ }
58
+
59
+ export function handleSummary(data) {
60
+ let overheadPercentage = null;
61
+ if (
62
+ data.metrics["http_req_duration{hive:enabled}"] &&
63
+ data.metrics["http_req_duration{hive:disabled}"]
64
+ ) {
65
+ const withHive =
66
+ data.metrics["http_req_duration{hive:enabled}"].values["avg"];
67
+ const withoutHive =
68
+ data.metrics["http_req_duration{hive:disabled}"].values["avg"];
69
+ overheadPercentage = 100 - (withHive * 100.0) / withoutHive;
70
+ }
71
+ if (__ENV.GITHUB_TOKEN) {
72
+ githubComment(data, {
73
+ token: __ENV.GITHUB_TOKEN,
74
+ commit: __ENV.GITHUB_SHA,
75
+ pr: __ENV.GITHUB_PR,
76
+ org: "charlypoly",
77
+ repo: "graphql-ruby-hive",
78
+ renderTitle: () => {
79
+ return overheadPercentage < 5
80
+ ? "✅ Benchmark Results"
81
+ : "❌ Benchmark Failed";
82
+ },
83
+ renderMessage: () => {
84
+ const result = [];
85
+ if (overheadPercentage > 5) {
86
+ result.push(
87
+ "**Performance regression detected**: it seems like your Pull Request adds some extra latency to GraphQL Hive operations processing"
88
+ );
89
+ } else {
90
+ result.push("Overhead <= 1%");
91
+ }
92
+ return result.join("\n");
93
+ },
94
+ });
95
+ }
96
+ return {
97
+ stdout: textSummary(data, { indent: " ", enableColors: true }),
98
+ };
99
+ }
data/k6/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "k6-usage-api",
3
+ "version": "0.0.0",
4
+ "main": "usage-api.js",
5
+ "author": "Charly POLY",
6
+ "license": "MIT",
7
+ "private": true,
8
+ "dependencies": {
9
+ "express": "^4.18.1"
10
+ }
11
+ }
data/k6/usage-api.js ADDED
@@ -0,0 +1,22 @@
1
+ const express = require("express");
2
+ const app = express();
3
+ const port = 8888;
4
+
5
+ app.use(express.json());
6
+
7
+ let count = 0;
8
+
9
+ app.get("/count", (req, res) => {
10
+ res.status(200).send({ count });
11
+ });
12
+
13
+ app.post("/usage", (req, res) => {
14
+ if (req.body && req.body.operations) {
15
+ count += Object.keys(req.body.operations).length;
16
+ }
17
+ res.status(200).send({ status: "ok " });
18
+ });
19
+
20
+ app.listen(port, () => {
21
+ console.log(`Usage API listening on port ${port}`);
22
+ });
data/k6/yarn.lock ADDED
@@ -0,0 +1,405 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ accepts@~1.3.8:
6
+ version "1.3.8"
7
+ resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e"
8
+ integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==
9
+ dependencies:
10
+ mime-types "~2.1.34"
11
+ negotiator "0.6.3"
12
+
13
+ array-flatten@1.1.1:
14
+ version "1.1.1"
15
+ resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
16
+ integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==
17
+
18
+ body-parser@1.20.0:
19
+ version "1.20.0"
20
+ resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.0.tgz#3de69bd89011c11573d7bfee6a64f11b6bd27cc5"
21
+ integrity sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==
22
+ dependencies:
23
+ bytes "3.1.2"
24
+ content-type "~1.0.4"
25
+ debug "2.6.9"
26
+ depd "2.0.0"
27
+ destroy "1.2.0"
28
+ http-errors "2.0.0"
29
+ iconv-lite "0.4.24"
30
+ on-finished "2.4.1"
31
+ qs "6.10.3"
32
+ raw-body "2.5.1"
33
+ type-is "~1.6.18"
34
+ unpipe "1.0.0"
35
+
36
+ bytes@3.1.2:
37
+ version "3.1.2"
38
+ resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
39
+ integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==
40
+
41
+ call-bind@^1.0.0:
42
+ version "1.0.2"
43
+ resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
44
+ integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==
45
+ dependencies:
46
+ function-bind "^1.1.1"
47
+ get-intrinsic "^1.0.2"
48
+
49
+ content-disposition@0.5.4:
50
+ version "0.5.4"
51
+ resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe"
52
+ integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==
53
+ dependencies:
54
+ safe-buffer "5.2.1"
55
+
56
+ content-type@~1.0.4:
57
+ version "1.0.4"
58
+ resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"
59
+ integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==
60
+
61
+ cookie-signature@1.0.6:
62
+ version "1.0.6"
63
+ resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
64
+ integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==
65
+
66
+ cookie@0.5.0:
67
+ version "0.5.0"
68
+ resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b"
69
+ integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==
70
+
71
+ debug@2.6.9:
72
+ version "2.6.9"
73
+ resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
74
+ integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
75
+ dependencies:
76
+ ms "2.0.0"
77
+
78
+ depd@2.0.0:
79
+ version "2.0.0"
80
+ resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df"
81
+ integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==
82
+
83
+ destroy@1.2.0:
84
+ version "1.2.0"
85
+ resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015"
86
+ integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==
87
+
88
+ ee-first@1.1.1:
89
+ version "1.1.1"
90
+ resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
91
+ integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
92
+
93
+ encodeurl@~1.0.2:
94
+ version "1.0.2"
95
+ resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
96
+ integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
97
+
98
+ escape-html@~1.0.3:
99
+ version "1.0.3"
100
+ resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
101
+ integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==
102
+
103
+ etag@~1.8.1:
104
+ version "1.8.1"
105
+ resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
106
+ integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==
107
+
108
+ express@^4.18.1:
109
+ version "4.18.1"
110
+ resolved "https://registry.yarnpkg.com/express/-/express-4.18.1.tgz#7797de8b9c72c857b9cd0e14a5eea80666267caf"
111
+ integrity sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==
112
+ dependencies:
113
+ accepts "~1.3.8"
114
+ array-flatten "1.1.1"
115
+ body-parser "1.20.0"
116
+ content-disposition "0.5.4"
117
+ content-type "~1.0.4"
118
+ cookie "0.5.0"
119
+ cookie-signature "1.0.6"
120
+ debug "2.6.9"
121
+ depd "2.0.0"
122
+ encodeurl "~1.0.2"
123
+ escape-html "~1.0.3"
124
+ etag "~1.8.1"
125
+ finalhandler "1.2.0"
126
+ fresh "0.5.2"
127
+ http-errors "2.0.0"
128
+ merge-descriptors "1.0.1"
129
+ methods "~1.1.2"
130
+ on-finished "2.4.1"
131
+ parseurl "~1.3.3"
132
+ path-to-regexp "0.1.7"
133
+ proxy-addr "~2.0.7"
134
+ qs "6.10.3"
135
+ range-parser "~1.2.1"
136
+ safe-buffer "5.2.1"
137
+ send "0.18.0"
138
+ serve-static "1.15.0"
139
+ setprototypeof "1.2.0"
140
+ statuses "2.0.1"
141
+ type-is "~1.6.18"
142
+ utils-merge "1.0.1"
143
+ vary "~1.1.2"
144
+
145
+ finalhandler@1.2.0:
146
+ version "1.2.0"
147
+ resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32"
148
+ integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==
149
+ dependencies:
150
+ debug "2.6.9"
151
+ encodeurl "~1.0.2"
152
+ escape-html "~1.0.3"
153
+ on-finished "2.4.1"
154
+ parseurl "~1.3.3"
155
+ statuses "2.0.1"
156
+ unpipe "~1.0.0"
157
+
158
+ forwarded@0.2.0:
159
+ version "0.2.0"
160
+ resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
161
+ integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==
162
+
163
+ fresh@0.5.2:
164
+ version "0.5.2"
165
+ resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
166
+ integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==
167
+
168
+ function-bind@^1.1.1:
169
+ version "1.1.1"
170
+ resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
171
+ integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
172
+
173
+ get-intrinsic@^1.0.2:
174
+ version "1.1.2"
175
+ resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.2.tgz#336975123e05ad0b7ba41f152ee4aadbea6cf598"
176
+ integrity sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==
177
+ dependencies:
178
+ function-bind "^1.1.1"
179
+ has "^1.0.3"
180
+ has-symbols "^1.0.3"
181
+
182
+ has-symbols@^1.0.3:
183
+ version "1.0.3"
184
+ resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8"
185
+ integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==
186
+
187
+ has@^1.0.3:
188
+ version "1.0.3"
189
+ resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
190
+ integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==
191
+ dependencies:
192
+ function-bind "^1.1.1"
193
+
194
+ http-errors@2.0.0:
195
+ version "2.0.0"
196
+ resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3"
197
+ integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==
198
+ dependencies:
199
+ depd "2.0.0"
200
+ inherits "2.0.4"
201
+ setprototypeof "1.2.0"
202
+ statuses "2.0.1"
203
+ toidentifier "1.0.1"
204
+
205
+ iconv-lite@0.4.24:
206
+ version "0.4.24"
207
+ resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
208
+ integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
209
+ dependencies:
210
+ safer-buffer ">= 2.1.2 < 3"
211
+
212
+ inherits@2.0.4:
213
+ version "2.0.4"
214
+ resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
215
+ integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
216
+
217
+ ipaddr.js@1.9.1:
218
+ version "1.9.1"
219
+ resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3"
220
+ integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==
221
+
222
+ media-typer@0.3.0:
223
+ version "0.3.0"
224
+ resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
225
+ integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==
226
+
227
+ merge-descriptors@1.0.1:
228
+ version "1.0.1"
229
+ resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
230
+ integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==
231
+
232
+ methods@~1.1.2:
233
+ version "1.1.2"
234
+ resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
235
+ integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==
236
+
237
+ mime-db@1.52.0:
238
+ version "1.52.0"
239
+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
240
+ integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
241
+
242
+ mime-types@~2.1.24, mime-types@~2.1.34:
243
+ version "2.1.35"
244
+ resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
245
+ integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
246
+ dependencies:
247
+ mime-db "1.52.0"
248
+
249
+ mime@1.6.0:
250
+ version "1.6.0"
251
+ resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
252
+ integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
253
+
254
+ ms@2.0.0:
255
+ version "2.0.0"
256
+ resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
257
+ integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==
258
+
259
+ ms@2.1.3:
260
+ version "2.1.3"
261
+ resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
262
+ integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
263
+
264
+ negotiator@0.6.3:
265
+ version "0.6.3"
266
+ resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
267
+ integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==
268
+
269
+ object-inspect@^1.9.0:
270
+ version "1.12.2"
271
+ resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea"
272
+ integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==
273
+
274
+ on-finished@2.4.1:
275
+ version "2.4.1"
276
+ resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f"
277
+ integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==
278
+ dependencies:
279
+ ee-first "1.1.1"
280
+
281
+ parseurl@~1.3.3:
282
+ version "1.3.3"
283
+ resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
284
+ integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
285
+
286
+ path-to-regexp@0.1.7:
287
+ version "0.1.7"
288
+ resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
289
+ integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==
290
+
291
+ proxy-addr@~2.0.7:
292
+ version "2.0.7"
293
+ resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025"
294
+ integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==
295
+ dependencies:
296
+ forwarded "0.2.0"
297
+ ipaddr.js "1.9.1"
298
+
299
+ qs@6.10.3:
300
+ version "6.10.3"
301
+ resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e"
302
+ integrity sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==
303
+ dependencies:
304
+ side-channel "^1.0.4"
305
+
306
+ range-parser@~1.2.1:
307
+ version "1.2.1"
308
+ resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
309
+ integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==
310
+
311
+ raw-body@2.5.1:
312
+ version "2.5.1"
313
+ resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857"
314
+ integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==
315
+ dependencies:
316
+ bytes "3.1.2"
317
+ http-errors "2.0.0"
318
+ iconv-lite "0.4.24"
319
+ unpipe "1.0.0"
320
+
321
+ safe-buffer@5.2.1:
322
+ version "5.2.1"
323
+ resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
324
+ integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
325
+
326
+ "safer-buffer@>= 2.1.2 < 3":
327
+ version "2.1.2"
328
+ resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
329
+ integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
330
+
331
+ send@0.18.0:
332
+ version "0.18.0"
333
+ resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be"
334
+ integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==
335
+ dependencies:
336
+ debug "2.6.9"
337
+ depd "2.0.0"
338
+ destroy "1.2.0"
339
+ encodeurl "~1.0.2"
340
+ escape-html "~1.0.3"
341
+ etag "~1.8.1"
342
+ fresh "0.5.2"
343
+ http-errors "2.0.0"
344
+ mime "1.6.0"
345
+ ms "2.1.3"
346
+ on-finished "2.4.1"
347
+ range-parser "~1.2.1"
348
+ statuses "2.0.1"
349
+
350
+ serve-static@1.15.0:
351
+ version "1.15.0"
352
+ resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540"
353
+ integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==
354
+ dependencies:
355
+ encodeurl "~1.0.2"
356
+ escape-html "~1.0.3"
357
+ parseurl "~1.3.3"
358
+ send "0.18.0"
359
+
360
+ setprototypeof@1.2.0:
361
+ version "1.2.0"
362
+ resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424"
363
+ integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==
364
+
365
+ side-channel@^1.0.4:
366
+ version "1.0.4"
367
+ resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
368
+ integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==
369
+ dependencies:
370
+ call-bind "^1.0.0"
371
+ get-intrinsic "^1.0.2"
372
+ object-inspect "^1.9.0"
373
+
374
+ statuses@2.0.1:
375
+ version "2.0.1"
376
+ resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63"
377
+ integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==
378
+
379
+ toidentifier@1.0.1:
380
+ version "1.0.1"
381
+ resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"
382
+ integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==
383
+
384
+ type-is@~1.6.18:
385
+ version "1.6.18"
386
+ resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
387
+ integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==
388
+ dependencies:
389
+ media-typer "0.3.0"
390
+ mime-types "~2.1.24"
391
+
392
+ unpipe@1.0.0, unpipe@~1.0.0:
393
+ version "1.0.0"
394
+ resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
395
+ integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==
396
+
397
+ utils-merge@1.0.1:
398
+ version "1.0.1"
399
+ resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
400
+ integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==
401
+
402
+ vary@~1.1.2:
403
+ version "1.1.2"
404
+ resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
405
+ integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==
@@ -5,7 +5,6 @@ module GraphQL
5
5
  # Fetch all users fields, input objects and enums
6
6
  class Analyzer < GraphQL::Analysis::AST::Analyzer
7
7
  def initialize(query_or_multiplex)
8
- puts query_or_multiplex.inspect
9
8
  super
10
9
  @used_fields = Set.new
11
10
  end
@@ -21,7 +21,7 @@ module GraphQL
21
21
  )
22
22
 
23
23
  http = ::Net::HTTP.new(uri.host, uri.port)
24
- http.use_ssl = true
24
+ http.use_ssl = @options[:port].to_s == '443'
25
25
  http.read_timeout = 2
26
26
  request = Net::HTTP::Post.new(uri.request_uri)
27
27
  request['content-type'] = 'application/json'
@@ -14,7 +14,6 @@ module GraphQL
14
14
  @thread = nil
15
15
  @operations_buffer = nil
16
16
  @client = nil
17
- @logger = nil
18
17
 
19
18
  def self.instance
20
19
  @@instance
@@ -24,35 +23,35 @@ module GraphQL
24
23
  @@instance = self
25
24
 
26
25
  @options = options
27
- @buffer_size = options[:buffer_size]
28
- @logger = options[:logger]
29
26
  @client = client
30
- @operations_buffer = []
31
27
 
28
+ @options_mutex = Mutex.new
32
29
  @queue = Queue.new
33
-
34
30
  @thread = Thread.new do
35
- while !@queue.empty? || !@queue.closed?
36
- operations = @queue.pop(false)
37
- process_operations operations
31
+ buffer = []
32
+ while (operation = @queue.pop(false))
33
+ @options[:logger].debug("add operation to buffer: #{operation}")
34
+ buffer << operation
35
+ @options_mutex.synchronize do
36
+ if buffer.size >= @options[:buffer_size]
37
+ @options[:logger].debug('buffer is full, sending!')
38
+ process_operations(buffer)
39
+ buffer = []
40
+ end
41
+ end
42
+ end
43
+ unless buffer.size.zero?
44
+ @options[:logger].debug('shuting down with buffer, sending!')
45
+ process_operations(buffer)
38
46
  end
39
47
  end
40
48
  end
41
49
 
42
50
  def add_operation(operation)
43
- @logger.debug("add operation to buffer: #{operation}")
44
-
45
- @operations_buffer << operation
46
-
47
- return unless @operations_buffer.size >= @buffer_size
48
-
49
- @logger.debug('buffer is full, sending!')
50
- @queue.push @operations_buffer
51
- @operations_buffer = []
51
+ @queue.push(operation)
52
52
  end
53
53
 
54
54
  def on_exit
55
- @queue.push @operations_buffer unless @operations_buffer.empty?
56
55
  @queue.close
57
56
  @thread.join
58
57
  end
@@ -70,7 +69,7 @@ module GraphQL
70
69
  add_operation_to_report(report, operation)
71
70
  end
72
71
 
73
- @logger.debug("sending report: #{report}")
72
+ @options[:logger].debug("sending report: #{report}")
74
73
 
75
74
  @client.send('/usage', report, :usage)
76
75
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Graphql
4
4
  module Hive
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
data/lib/graphql-hive.rb CHANGED
@@ -51,6 +51,8 @@ module GraphQL
51
51
 
52
52
  DEFAULT_OPTIONS = {
53
53
  enabled: true,
54
+ debug: false,
55
+ port: '443',
54
56
  collect_usage: true,
55
57
  read_operations: true,
56
58
  report_schema: true,
@@ -71,7 +73,7 @@ module GraphQL
71
73
 
72
74
  def initialize(options = {})
73
75
  opts = DEFAULT_OPTIONS.merge(options)
74
- validate_options!(opts)
76
+ initialize_options!(opts)
75
77
  super(opts)
76
78
 
77
79
  @@instance = self
@@ -144,13 +146,14 @@ module GraphQL
144
146
 
145
147
  private
146
148
 
147
- def validate_options!(options)
149
+ def initialize_options!(options)
148
150
  if options[:logger].nil?
149
- options[:logger] = Logger.new($stdout)
151
+ options[:logger] = Logger.new($stderr)
150
152
  original_formatter = Logger::Formatter.new
151
153
  options[:logger].formatter = proc { |severity, datetime, progname, msg|
152
154
  original_formatter.call(severity, datetime, progname, "[hive] #{msg.dump}")
153
155
  }
156
+ options[:logger].level = options[:debug] ? Logger::DEBUG : Logger::INFO
154
157
  end
155
158
  if !options.include?(:token) && (!options.include?(:enabled) || options.enabled)
156
159
  options[:logger].warn('`token` options is missing')
@@ -194,8 +197,6 @@ module GraphQL
194
197
  }
195
198
  }
196
199
 
197
- puts(JSON.generate(body))
198
-
199
200
  @client.send('/registry', body, :'report-schema')
200
201
  end
201
202
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-hive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charly POLY
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -88,6 +88,7 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
+ - ".github/workflows/benchmark.yml"
91
92
  - ".github/workflows/ci.yml"
92
93
  - ".gitignore"
93
94
  - ".rspec"
@@ -95,7 +96,6 @@ files:
95
96
  - Gemfile
96
97
  - Gemfile.lock
97
98
  - LICENSE
98
- - LICENSE.txt
99
99
  - README.md
100
100
  - Rakefile
101
101
  - cover.png
@@ -105,6 +105,15 @@ files:
105
105
  - examples/simple-api/config.ru
106
106
  - examples/simple-api/schema.rb
107
107
  - graphql-hive.gemspec
108
+ - k6/graphql-api/Gemfile
109
+ - k6/graphql-api/Gemfile.lock
110
+ - k6/graphql-api/app.rb
111
+ - k6/graphql-api/config.ru
112
+ - k6/graphql-api/schema.rb
113
+ - k6/k6.js
114
+ - k6/package.json
115
+ - k6/usage-api.js
116
+ - k6/yarn.lock
108
117
  - lib/graphql-hive.rb
109
118
  - lib/graphql-hive/analyzer.rb
110
119
  - lib/graphql-hive/client.rb
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 Charly POLY
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.