gruf 2.18.0 → 2.20.0
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/CHANGELOG.md +11 -0
- data/README.md +1 -1
- data/gruf.gemspec +2 -4
- data/lib/gruf/cli/executor.rb +1 -1
- data/lib/gruf/configuration.rb +5 -2
- data/lib/gruf/error.rb +1 -1
- data/lib/gruf/interceptors/active_record/connection_reset.rb +0 -4
- data/lib/gruf/interceptors/instrumentation/request_logging/interceptor.rb +1 -1
- data/lib/gruf/interceptors/rails/reloader.rb +31 -0
- data/lib/gruf/server.rb +1 -1
- data/lib/gruf/version.rb +1 -1
- data/lib/gruf.rb +4 -6
- metadata +7 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2166dad751c35484b12695d4d7a733c7c629a9ed0ee6088d6135f261d248c787
|
4
|
+
data.tar.gz: 1787a34eefd69424a5c1902f0d8c097657e1dba36be761a238abc803bf3d4c02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b3da76c05e413641d0be365bf717fddbe86767975eb9f69ffc7bfd3011af87569bb419ca0ccaa12bf4e49b6a80bc31baa3759e214f44617b87d94d2ef4f8cf2
|
7
|
+
data.tar.gz: d0457693dfb0d7bfe73675e3b0d3cdfc985a2d314c8a5027eb63cc44b254c5e9f4f196fa6101524cb6bb1f1f1f9bfa231b46b2f7b996737cb226bdb025ad4b30
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
|
|
2
2
|
|
3
3
|
### Pending release
|
4
4
|
|
5
|
+
### 2.20.0
|
6
|
+
|
7
|
+
* [#190] Remove unsued `e2mmap` and `thwait` gems from `runtime_dependency`.
|
8
|
+
* [#194] Add interceptor to reload Rails app code accross requests
|
9
|
+
* [#209] Removes manual `establish_connection` and active connection check for each request from `Gruf::Interceptors::ActiveRecord::ConnectionReset`.
|
10
|
+
|
11
|
+
### 2.19.0
|
12
|
+
|
13
|
+
* [#197] Add support for Ruby 3.3
|
14
|
+
* Drop support for Ruby 2.x
|
15
|
+
|
5
16
|
### 2.18.0
|
6
17
|
|
7
18
|
* Add `GRUF_USE_DEFAULT_INTERCEPTORS` ENV to dynamically enable/disable default interceptors
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ up fast and efficiently at scale. Some of its features include:
|
|
17
17
|
still preserving gRPC BadStatus codes
|
18
18
|
* Server and client execution timings in responses
|
19
19
|
|
20
|
-
gruf currently has active support for gRPC 1.10.x+. gruf is compatible and tested with Ruby
|
20
|
+
gruf currently has active support for gRPC 1.10.x+. gruf is compatible and tested with Ruby 3.0-3.3.
|
21
21
|
gruf is also not [Rails](https://github.com/rails/rails)-specific, and can be used in any Ruby framework
|
22
22
|
(such as [Grape](https://github.com/ruby-grape/grape) or [dry-rb](https://dry-rb.org/), for instance).
|
23
23
|
|
data/gruf.gemspec
CHANGED
@@ -32,11 +32,11 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables << 'gruf'
|
33
33
|
spec.require_paths = ['lib']
|
34
34
|
|
35
|
-
spec.required_ruby_version = '>=
|
35
|
+
spec.required_ruby_version = '>= 3.0', '< 3.4'
|
36
36
|
|
37
37
|
spec.metadata = {
|
38
38
|
'bug_tracker_uri' => 'https://github.com/bigcommerce/gruf/issues',
|
39
|
-
'changelog_uri' => 'https://github.com/bigcommerce/gruf/CHANGELOG.md',
|
39
|
+
'changelog_uri' => 'https://github.com/bigcommerce/gruf/blob/main/CHANGELOG.md',
|
40
40
|
'homepage_uri' => 'https://github.com/bigcommerce/gruf',
|
41
41
|
'rubygems_mfa_required' => 'true',
|
42
42
|
'source_code_uri' => 'https://github.com/bigcommerce/gruf',
|
@@ -45,11 +45,9 @@ Gem::Specification.new do |spec|
|
|
45
45
|
|
46
46
|
spec.add_runtime_dependency 'activesupport', '> 4'
|
47
47
|
spec.add_runtime_dependency 'concurrent-ruby', '> 1'
|
48
|
-
spec.add_runtime_dependency 'e2mmap', '>= 0.1'
|
49
48
|
spec.add_runtime_dependency 'grpc', '~> 1.10'
|
50
49
|
spec.add_runtime_dependency 'grpc-tools', '~> 1.10'
|
51
50
|
spec.add_runtime_dependency 'json', '>= 2.3'
|
52
51
|
spec.add_runtime_dependency 'slop', '>= 4.6'
|
53
|
-
spec.add_runtime_dependency 'thwait', '>= 0.1'
|
54
52
|
spec.add_runtime_dependency 'zeitwerk', '>= 2'
|
55
53
|
end
|
data/lib/gruf/cli/executor.rb
CHANGED
@@ -182,7 +182,7 @@ module Gruf
|
|
182
182
|
# next check CLI arguments
|
183
183
|
services = @options[:services].to_s.split(',').map(&:strip).uniq
|
184
184
|
# finally, if none, use global gruf autoloaded services
|
185
|
-
services =
|
185
|
+
services = ::Gruf.services || [] unless services.any?
|
186
186
|
|
187
187
|
services
|
188
188
|
end
|
data/lib/gruf/configuration.rb
CHANGED
@@ -121,7 +121,7 @@ module Gruf
|
|
121
121
|
}.freeze
|
122
122
|
}.freeze
|
123
123
|
|
124
|
-
attr_accessor(*
|
124
|
+
attr_accessor(*VALID_CONFIG_KEYS.keys)
|
125
125
|
|
126
126
|
##
|
127
127
|
# Whenever this is extended into a class, setup the defaults
|
@@ -164,7 +164,7 @@ module Gruf
|
|
164
164
|
#
|
165
165
|
def reset
|
166
166
|
VALID_CONFIG_KEYS.each do |k, v|
|
167
|
-
send("#{k}=", v)
|
167
|
+
send(:"#{k}=", v)
|
168
168
|
end
|
169
169
|
self.server_binding_url = "#{::ENV.fetch('GRPC_SERVER_HOST',
|
170
170
|
'0.0.0.0')}:#{::ENV.fetch('GRPC_SERVER_PORT', 9_001)}"
|
@@ -189,6 +189,9 @@ module Gruf
|
|
189
189
|
self.use_default_interceptors = ::ENV.fetch('GRUF_USE_DEFAULT_INTERCEPTORS', 1).to_i.positive?
|
190
190
|
|
191
191
|
if use_default_interceptors
|
192
|
+
if defined?(::Rails)
|
193
|
+
interceptors.use(::Gruf::Interceptors::Rails::Reloader, reloader: Rails.application.reloader)
|
194
|
+
end
|
192
195
|
interceptors.use(::Gruf::Interceptors::ActiveRecord::ConnectionReset)
|
193
196
|
interceptors.use(::Gruf::Interceptors::Instrumentation::OutputMetadataTimer)
|
194
197
|
end
|
data/lib/gruf/error.rb
CHANGED
@@ -27,10 +27,6 @@ module Gruf
|
|
27
27
|
# connection pool, we need to ensure that this is done to properly
|
28
28
|
#
|
29
29
|
def call
|
30
|
-
if enabled?
|
31
|
-
target_classes.each { |klass| klass.establish_connection unless klass.connection.active? }
|
32
|
-
end
|
33
|
-
|
34
30
|
yield
|
35
31
|
ensure
|
36
32
|
target_classes.each(&:clear_active_connections!) if enabled?
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
6
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
7
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
8
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
11
|
+
# Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
14
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
16
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
17
|
+
#
|
18
|
+
module Gruf
|
19
|
+
module Interceptors
|
20
|
+
module Rails
|
21
|
+
##
|
22
|
+
# Triggers rails code reloading between requests
|
23
|
+
#
|
24
|
+
class Reloader < ::Gruf::Interceptors::ServerInterceptor
|
25
|
+
def call(&block)
|
26
|
+
options[:reloader].wrap(&block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/gruf/server.rb
CHANGED
data/lib/gruf/version.rb
CHANGED
data/lib/gruf.rb
CHANGED
@@ -24,12 +24,10 @@ require 'base64'
|
|
24
24
|
|
25
25
|
# use Zeitwerk to lazily autoload all the files in the lib directory
|
26
26
|
require 'zeitwerk'
|
27
|
-
loader =
|
28
|
-
|
29
|
-
loader.
|
30
|
-
loader.ignore("#{
|
31
|
-
loader.ignore("#{__dir__}/gruf/controllers/health_controller.rb")
|
32
|
-
loader.push_dir(__dir__)
|
27
|
+
loader = Zeitwerk::Loader.for_gem
|
28
|
+
lib = File.dirname(__FILE__)
|
29
|
+
loader.ignore("#{lib}/gruf/integrations/rails/railtie.rb")
|
30
|
+
loader.ignore("#{lib}/gruf/controllers/health_controller.rb")
|
33
31
|
loader.setup
|
34
32
|
|
35
33
|
require_relative 'gruf/integrations/rails/railtie' if defined?(::Rails)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaun McCormick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: e2mmap
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0.1'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.1'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: grpc
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,20 +94,6 @@ dependencies:
|
|
108
94
|
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '4.6'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: thwait
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.1'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.1'
|
125
97
|
- !ruby/object:Gem::Dependency
|
126
98
|
name: zeitwerk
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,6 +155,7 @@ files:
|
|
183
155
|
- lib/gruf/interceptors/instrumentation/request_logging/formatters/plain.rb
|
184
156
|
- lib/gruf/interceptors/instrumentation/request_logging/interceptor.rb
|
185
157
|
- lib/gruf/interceptors/instrumentation/statsd.rb
|
158
|
+
- lib/gruf/interceptors/rails/reloader.rb
|
186
159
|
- lib/gruf/interceptors/registry.rb
|
187
160
|
- lib/gruf/interceptors/server_interceptor.rb
|
188
161
|
- lib/gruf/interceptors/timer.rb
|
@@ -201,7 +174,7 @@ licenses:
|
|
201
174
|
- MIT
|
202
175
|
metadata:
|
203
176
|
bug_tracker_uri: https://github.com/bigcommerce/gruf/issues
|
204
|
-
changelog_uri: https://github.com/bigcommerce/gruf/CHANGELOG.md
|
177
|
+
changelog_uri: https://github.com/bigcommerce/gruf/blob/main/CHANGELOG.md
|
205
178
|
homepage_uri: https://github.com/bigcommerce/gruf
|
206
179
|
rubygems_mfa_required: 'true'
|
207
180
|
source_code_uri: https://github.com/bigcommerce/gruf
|
@@ -214,17 +187,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
187
|
requirements:
|
215
188
|
- - ">="
|
216
189
|
- !ruby/object:Gem::Version
|
217
|
-
version: '
|
190
|
+
version: '3.0'
|
218
191
|
- - "<"
|
219
192
|
- !ruby/object:Gem::Version
|
220
|
-
version: '3.
|
193
|
+
version: '3.4'
|
221
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
195
|
requirements:
|
223
196
|
- - ">="
|
224
197
|
- !ruby/object:Gem::Version
|
225
198
|
version: '0'
|
226
199
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
200
|
+
rubygems_version: 3.5.3
|
228
201
|
signing_key:
|
229
202
|
specification_version: 4
|
230
203
|
summary: gRPC Ruby Framework
|