stellate 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stellate.rb +7 -5
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf645f43b4d1c0d62fd71ce6739b62c5046f84387a4687d34f0dbe5155d16150
|
4
|
+
data.tar.gz: bea394e5b879a938810d0d0555071032fedd117494af2452be7ad67f9ee4fa6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87209538300252aa2fde91ebe1fa8b97ed64346aa90d7740fcd07fd5493490326a012d63b13a87b4c1d304f22be283f05ac5d55f9fe2a8b8f308ab41324ff843
|
7
|
+
data.tar.gz: 247e1efc7ca6bf954e482af75b3dccd587ba7ace9393e699358a936e0fc04d507a9219d9c61db125d6b53c62b692a7bcf15f9f5234c2b9b42a0b388b66cee55a
|
data/lib/stellate.rb
CHANGED
@@ -4,7 +4,7 @@ require 'uri'
|
|
4
4
|
require 'net/http'
|
5
5
|
|
6
6
|
module Stellate
|
7
|
-
VERSION = '0.0.
|
7
|
+
VERSION = '0.0.2'
|
8
8
|
|
9
9
|
# Extend your GraphQL::Schema with this module to enable easy Stellate
|
10
10
|
# Metrics Logging.
|
@@ -46,7 +46,7 @@ module Stellate
|
|
46
46
|
"operation": query_str,
|
47
47
|
"variableHash": create_blake3_hash(kwargs[:variables].to_json),
|
48
48
|
"method": kwargs[:method].is_a?(String) ? kwargs[:method] : 'POST',
|
49
|
-
"elapsed": elapsed,
|
49
|
+
"elapsed": elapsed.round,
|
50
50
|
"responseSize": response.length,
|
51
51
|
"responseHash": create_blake3_hash(response),
|
52
52
|
"statusCode": 200,
|
@@ -69,12 +69,13 @@ module Stellate
|
|
69
69
|
|
70
70
|
# TODO: make this an async request to avoid blocking the response
|
71
71
|
begin
|
72
|
-
Net::HTTP.post(
|
72
|
+
res = Net::HTTP.post(
|
73
73
|
URI("https://#{@stellate_service_name}.stellate.sh/log"),
|
74
74
|
payload.to_json,
|
75
75
|
'Content-Type' => 'application/json',
|
76
76
|
'Stellate-Logging-Token' => @stellate_token
|
77
77
|
)
|
78
|
+
puts "Failed to log metrics to Stellate: #{res.body}" if res.code.to_i >= 300
|
78
79
|
rescue StandardError => e
|
79
80
|
puts "Failed to log metrics to Stellate: #{e}"
|
80
81
|
end
|
@@ -101,7 +102,7 @@ module Stellate
|
|
101
102
|
end
|
102
103
|
|
103
104
|
unless schema.stellate_token.is_a?(String)
|
104
|
-
puts 'Missing token in order to
|
105
|
+
puts 'Missing token in order to sync schema to Stellate'
|
105
106
|
return
|
106
107
|
end
|
107
108
|
|
@@ -109,12 +110,13 @@ module Stellate
|
|
109
110
|
|
110
111
|
# TODO: make this an async request to avoid blocking the request
|
111
112
|
begin
|
112
|
-
Net::HTTP.post(
|
113
|
+
res = Net::HTTP.post(
|
113
114
|
URI("https://#{schema.stellate_service_name}.stellate.sh/schema"),
|
114
115
|
{ schema: introspection }.to_json,
|
115
116
|
'Content-Type' => 'application/json',
|
116
117
|
'Stellate-Schema-Token' => schema.stellate_token
|
117
118
|
)
|
119
|
+
puts "Failed to sync schema to Stellate: #{res.body}" if res.code.to_i >= 300
|
118
120
|
rescue StandardError => e
|
119
121
|
puts "Failed to sync schema to Stellate: #{e}"
|
120
122
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stellate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stellate
|
@@ -38,8 +38,10 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.13.0
|
41
|
-
description:
|
42
|
-
|
41
|
+
description: |
|
42
|
+
Add Stellate Metrics Logging and Schema Syncing to your GraphQL Ruby API
|
43
|
+
with a few lines of code, click this link for specific set up instructions:
|
44
|
+
https://github.com/StellateHQ/stellate-graphql-ruby
|
43
45
|
email: eng@stellate.co
|
44
46
|
executables: []
|
45
47
|
extensions: []
|