gruf 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/gruf.gemspec +2 -1
- data/lib/gruf.rb +2 -0
- data/lib/gruf/cli/executor.rb +3 -1
- data/lib/gruf/client.rb +6 -4
- data/lib/gruf/client/error.rb +2 -0
- data/lib/gruf/client/error_factory.rb +3 -1
- data/lib/gruf/configuration.rb +2 -0
- data/lib/gruf/controllers/base.rb +2 -0
- data/lib/gruf/controllers/request.rb +2 -0
- data/lib/gruf/controllers/service_binder.rb +2 -0
- data/lib/gruf/error.rb +4 -2
- data/lib/gruf/errors/debug_info.rb +4 -2
- data/lib/gruf/errors/field.rb +2 -0
- data/lib/gruf/errors/helpers.rb +2 -0
- data/lib/gruf/instrumentable_grpc_server.rb +3 -1
- data/lib/gruf/integrations/rails/railtie.rb +2 -0
- data/lib/gruf/interceptors/active_record/connection_reset.rb +2 -0
- data/lib/gruf/interceptors/authentication/basic.rb +2 -0
- data/lib/gruf/interceptors/base.rb +2 -0
- data/lib/gruf/interceptors/client_interceptor.rb +2 -0
- data/lib/gruf/interceptors/context.rb +2 -0
- data/lib/gruf/interceptors/instrumentation/output_metadata_timer.rb +2 -0
- data/lib/gruf/interceptors/instrumentation/request_logging/formatters/base.rb +2 -0
- data/lib/gruf/interceptors/instrumentation/request_logging/formatters/logstash.rb +2 -0
- data/lib/gruf/interceptors/instrumentation/request_logging/formatters/plain.rb +2 -0
- data/lib/gruf/interceptors/instrumentation/request_logging/interceptor.rb +2 -0
- data/lib/gruf/interceptors/instrumentation/statsd.rb +2 -0
- data/lib/gruf/interceptors/registry.rb +2 -0
- data/lib/gruf/interceptors/server_interceptor.rb +2 -0
- data/lib/gruf/interceptors/timer.rb +2 -0
- data/lib/gruf/loggable.rb +2 -0
- data/lib/gruf/logging.rb +2 -0
- data/lib/gruf/outbound/request_context.rb +2 -0
- data/lib/gruf/response.rb +2 -0
- data/lib/gruf/serializers/errors/base.rb +2 -0
- data/lib/gruf/serializers/errors/json.rb +2 -0
- data/lib/gruf/server.rb +2 -0
- data/lib/gruf/synchronized_client.rb +2 -0
- data/lib/gruf/timer.rb +2 -0
- data/lib/gruf/version.rb +3 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7280830d85a916cbc0f80677e072402b4336c59396927b6ea110943b59e5732
|
4
|
+
data.tar.gz: 9e2de4546c670e19f7007fc713d70485e2f45d0936c508b13512f9896efeac83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b87c53908df9b5f577ff374f404f520168865092117678f4ce32b4b3264e226272965e27a243a32548bcbd32bf496fe5139801c19af549d9d641f071cda544b7
|
7
|
+
data.tar.gz: b9b719dc54a055313ab7ee76d95438305989aa961c4c78332555423580371842bc51ed621eae782a2d45df3cab3c9f231d6f4e512afedfda033ed7150a65fa26
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# gruf - gRPC Ruby Framework
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![CircleCI](https://circleci.com/gh/bigcommerce/gruf/tree/master.svg?style=svg)](https://circleci.com/gh/bigcommerce/gruf/tree/master) [![Gem Version](https://badge.fury.io/rb/gruf.svg)](https://badge.fury.io/rb/gruf) [![Documentation](https://inch-ci.org/github/bigcommerce/gruf.svg?branch=master)](https://inch-ci.org/github/bigcommerce/gruf?branch=master)
|
4
4
|
|
5
5
|
gruf is a Ruby framework that wraps the [gRPC Ruby library](https://github.com/grpc/grpc/tree/master/src/ruby) to
|
6
6
|
provide a more streamlined integration into Ruby and Ruby on Rails applications.
|
data/gruf.gemspec
CHANGED
data/lib/gruf.rb
CHANGED
data/lib/gruf/cli/executor.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -38,7 +40,7 @@ module Gruf
|
|
38
40
|
server.start!
|
39
41
|
rescue StandardError => e
|
40
42
|
msg = "FATAL ERROR: #{e.message} #{e.backtrace.join("\n")}"
|
41
|
-
logger = Gruf.logger || Logger.new(STDERR)
|
43
|
+
logger = Gruf.logger || ::Logger.new(STDERR)
|
42
44
|
logger.fatal msg
|
43
45
|
end
|
44
46
|
|
data/lib/gruf/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -56,8 +58,8 @@ module Gruf
|
|
56
58
|
@base_klass = service
|
57
59
|
@service_klass = "#{base_klass}::Service".constantize
|
58
60
|
@opts = options || {}
|
59
|
-
@opts[:password] =
|
60
|
-
@opts[:hostname] =
|
61
|
+
@opts[:password] = @opts.fetch(:password, '').to_s
|
62
|
+
@opts[:hostname] = @opts.fetch(:hostname, Gruf.default_client_host)
|
61
63
|
@error_factory = Gruf::Client::ErrorFactory.new
|
62
64
|
client_options[:timeout] = client_options[:timeout].to_i if client_options.key?(:timeout)
|
63
65
|
client = "#{service}::Stub".constantize.new(@opts[:hostname], build_ssl_credentials, client_options)
|
@@ -152,7 +154,7 @@ module Gruf
|
|
152
154
|
#
|
153
155
|
def request_object(request_method, params = {})
|
154
156
|
desc = rpc_desc(request_method)
|
155
|
-
desc
|
157
|
+
desc&.input ? desc.input.new(params) : nil
|
156
158
|
end
|
157
159
|
|
158
160
|
##
|
@@ -162,7 +164,7 @@ module Gruf
|
|
162
164
|
#
|
163
165
|
def call_signature(request_method)
|
164
166
|
desc = rpc_desc(request_method)
|
165
|
-
desc
|
167
|
+
desc&.name ? desc.name.to_s.underscore.to_sym : nil
|
166
168
|
end
|
167
169
|
|
168
170
|
##
|
data/lib/gruf/client/error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -86,7 +88,7 @@ module Gruf
|
|
86
88
|
return @default_class unless error_class.ancestors.include?(Gruf::Client::Errors::Base)
|
87
89
|
|
88
90
|
error_class
|
89
|
-
rescue NameError =>
|
91
|
+
rescue NameError => _e
|
90
92
|
@default_class
|
91
93
|
end
|
92
94
|
|
data/lib/gruf/configuration.rb
CHANGED
data/lib/gruf/error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -54,8 +56,8 @@ module Gruf
|
|
54
56
|
# not to overflow this limit, or the response message will never
|
55
57
|
# be sent. Instead, resource_exhausted will be thrown.
|
56
58
|
MAX_METADATA_SIZE = 7.5 * 1_024
|
57
|
-
METADATA_SIZE_EXCEEDED_CODE = 'metadata_size_exceeded'
|
58
|
-
METADATA_SIZE_EXCEEDED_MSG = 'Metadata too long, risks exceeding http2 trailing metadata limit.'
|
59
|
+
METADATA_SIZE_EXCEEDED_CODE = 'metadata_size_exceeded'
|
60
|
+
METADATA_SIZE_EXCEEDED_MSG = 'Metadata too long, risks exceeding http2 trailing metadata limit.'
|
59
61
|
|
60
62
|
# @return [Symbol] The given internal gRPC code for the error
|
61
63
|
attr_accessor :code
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -34,8 +36,8 @@ module Gruf
|
|
34
36
|
|
35
37
|
# Limit the size of the stack trace to reduce risk of overflowing metadata
|
36
38
|
stack_trace_limit = Gruf.backtrace_limit.to_i
|
37
|
-
stack_trace_limit = 10 if stack_trace_limit
|
38
|
-
@stack_trace = @stack_trace[0..stack_trace_limit] if stack_trace_limit
|
39
|
+
stack_trace_limit = 10 if stack_trace_limit.negative?
|
40
|
+
@stack_trace = @stack_trace[0..stack_trace_limit] if stack_trace_limit.positive?
|
39
41
|
end
|
40
42
|
|
41
43
|
##
|
data/lib/gruf/errors/field.rb
CHANGED
data/lib/gruf/errors/helpers.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Gruf
|
2
4
|
##
|
3
5
|
# A subclass of GRPC::RpcServer that can be used for enhanced monitoring
|
@@ -36,7 +38,7 @@ module Gruf
|
|
36
38
|
# Notify the event listener of something interesting
|
37
39
|
#
|
38
40
|
def notify(event)
|
39
|
-
return
|
41
|
+
return if @event_listener_proc.nil? || !@event_listener_proc.respond_to?(:call)
|
40
42
|
|
41
43
|
@event_listener_proc.call(event)
|
42
44
|
end
|
data/lib/gruf/loggable.rb
CHANGED
data/lib/gruf/logging.rb
CHANGED
data/lib/gruf/response.rb
CHANGED
data/lib/gruf/server.rb
CHANGED
data/lib/gruf/timer.rb
CHANGED
data/lib/gruf/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -14,5 +16,5 @@
|
|
14
16
|
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
17
|
#
|
16
18
|
module Gruf
|
17
|
-
VERSION = '2.6.
|
19
|
+
VERSION = '2.6.1'
|
18
20
|
end
|
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.6.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaun McCormick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -193,7 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
requirements: []
|
196
|
-
|
196
|
+
rubyforge_project:
|
197
|
+
rubygems_version: 2.7.7
|
197
198
|
signing_key:
|
198
199
|
specification_version: 4
|
199
200
|
summary: gRPC Ruby Framework
|