graphql-hive 0.4.0 → 0.4.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/k6/graphql-api/Gemfile.lock +1 -1
- data/lib/graphql-hive/client.rb +19 -7
- data/lib/graphql-hive/usage_reporter.rb +3 -5
- data/lib/graphql-hive/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa05eaf88fa4240d8ee2364b48a2b7152eec226c2d657156a87efdb5f98eb2c3
|
4
|
+
data.tar.gz: 72e529bf8227f49d5a6c3602c5375feee671263f0e3df31c6b60cd034aff0910
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3669a7e7bedabc6b8dfd3b471fa921bfb34aafed0a5fcc927baca80d55766903ff9ea7aad55460cb72ab8fd38d3f54cf91b1ef345ddb7789048b7c898f4b36fd
|
7
|
+
data.tar.gz: 003c658d94088ea6f89b4a37b2124f907fad3240bf9e2150fffe5ca62d9e2d78ab096f7fe6363e2b7a361f82e7fb2a711c3670ce5e8477986cacae5c8991fbb4
|
data/Gemfile.lock
CHANGED
data/k6/graphql-api/Gemfile.lock
CHANGED
data/lib/graphql-hive/client.rb
CHANGED
@@ -20,22 +20,34 @@ module GraphQL
|
|
20
20
|
path: path
|
21
21
|
)
|
22
22
|
|
23
|
+
http = setup_http(uri)
|
24
|
+
request = build_request(uri, body)
|
25
|
+
response = http.request(request)
|
26
|
+
|
27
|
+
@options[:logger].debug(response.inspect)
|
28
|
+
@options[:logger].debug(response.body.inspect)
|
29
|
+
rescue StandardError => e
|
30
|
+
@options[:logger].fatal("Failed to send data: #{e}")
|
31
|
+
raise e
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup_http(uri)
|
23
35
|
http = ::Net::HTTP.new(uri.host, uri.port)
|
24
36
|
http.use_ssl = @options[:port].to_s == '443'
|
25
37
|
http.read_timeout = 2
|
38
|
+
http
|
39
|
+
end
|
40
|
+
|
41
|
+
def build_request(uri, body)
|
26
42
|
request = Net::HTTP::Post.new(uri.request_uri)
|
43
|
+
request['Authorization'] = @options[:token]
|
44
|
+
request['X-Usage-API-Version'] = '2'
|
27
45
|
request['content-type'] = 'application/json'
|
28
|
-
request['x-api-token'] = @options[:token]
|
29
46
|
request['User-Agent'] = "Hive@#{Graphql::Hive::VERSION}"
|
30
47
|
request['graphql-client-name'] = 'Hive Ruby Client'
|
31
48
|
request['graphql-client-version'] = Graphql::Hive::VERSION
|
32
49
|
request.body = JSON.generate(body)
|
33
|
-
|
34
|
-
|
35
|
-
@options[:logger].debug(response.inspect)
|
36
|
-
@options[:logger].debug(response.body.inspect)
|
37
|
-
rescue StandardError => e
|
38
|
-
@options[:logger].fatal("Failed to send data: #{e}")
|
50
|
+
request
|
39
51
|
end
|
40
52
|
end
|
41
53
|
end
|
@@ -128,8 +128,7 @@ module GraphQL
|
|
128
128
|
execution: {
|
129
129
|
ok: errors[:errorsTotal].zero?,
|
130
130
|
duration: duration,
|
131
|
-
errorsTotal: errors[:errorsTotal]
|
132
|
-
errors: errors[:errors]
|
131
|
+
errorsTotal: errors[:errorsTotal]
|
133
132
|
}
|
134
133
|
}
|
135
134
|
|
@@ -148,12 +147,11 @@ module GraphQL
|
|
148
147
|
end
|
149
148
|
|
150
149
|
def errors_from_results(results)
|
151
|
-
acc = { errorsTotal: 0
|
150
|
+
acc = { errorsTotal: 0 }
|
152
151
|
results.each do |result|
|
153
152
|
errors = result.to_h.fetch('errors', [])
|
154
|
-
errors.each do
|
153
|
+
errors.each do
|
155
154
|
acc[:errorsTotal] += 1
|
156
|
-
acc[:errors] << { message: error['message'], path: error['path']&.join('.') }
|
157
155
|
end
|
158
156
|
end
|
159
157
|
acc
|
data/lib/graphql-hive/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charly POLY
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
rubygems_version: 3.5.
|
155
|
+
rubygems_version: 3.5.16
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: '"GraphQL Hive integration for `graphql-ruby`"'
|