grpcx 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +21 -0
- data/.rubocop.yml +12 -3
- data/Gemfile.lock +70 -49
- data/README.md +2 -4
- data/grpcx.gemspec +2 -2
- data/lib/grpcx/server.rb +2 -2
- data/spec/lib/entity_spec.rb +1 -1
- data/spec/lib/server_spec.rb +3 -3
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1a29ef56f02c4f3c6b9e5619371f91323bf4936c68f005b5d5ff4a4e1d5ade2
|
4
|
+
data.tar.gz: e397ccb4be91b3d9b7fadba057d2882cdbe7b0bebe6e9d5039daf1b76331cea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f5791ed4d2a2ea9c12a140422635a50635adaaa3677cc52deaff74c38e48115569ba6f3ba34bb6efdaa1bbd7bb3aad6fdfa095ef82734b0404de969f1376aef
|
7
|
+
data.tar.gz: 22dbbb57b6a72bb376afd1709645dce56a765eb2ac75ebe796277561ed9622644637e3c74950a464f6a6ede49bd10dd92d72f5da958488cdfeaa6e362c62822c
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Test
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- main
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- main
|
9
|
+
jobs:
|
10
|
+
ruby:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ["2.5", "2.6", "2.7", "3.0"]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler-cache: true
|
21
|
+
- run: bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
-
|
2
|
-
-
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-bsm:
|
3
|
+
- default.yml
|
4
|
+
inherit_mode:
|
5
|
+
merge:
|
6
|
+
- Exclude
|
3
7
|
|
4
8
|
AllCops:
|
5
|
-
TargetRubyVersion: 2.5
|
9
|
+
TargetRubyVersion: "2.5"
|
10
|
+
|
11
|
+
RSpec/FilePath:
|
12
|
+
Enabled: false
|
13
|
+
Lint/EmptyBlock:
|
14
|
+
Enabled: false
|
data/Gemfile.lock
CHANGED
@@ -1,70 +1,91 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grpcx (0.3.
|
4
|
+
grpcx (0.3.1)
|
5
5
|
activesupport (>= 5.0)
|
6
6
|
grpc (>= 1.8.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (6.
|
12
|
-
activesupport (= 6.
|
13
|
-
activerecord (6.
|
14
|
-
activemodel (= 6.
|
15
|
-
activesupport (= 6.
|
16
|
-
activesupport (6.
|
11
|
+
activemodel (6.1.3.1)
|
12
|
+
activesupport (= 6.1.3.1)
|
13
|
+
activerecord (6.1.3.1)
|
14
|
+
activemodel (= 6.1.3.1)
|
15
|
+
activesupport (= 6.1.3.1)
|
16
|
+
activesupport (6.1.3.1)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>=
|
19
|
-
minitest (
|
20
|
-
tzinfo (~>
|
21
|
-
zeitwerk (~> 2.
|
22
|
-
ast (2.4.
|
23
|
-
concurrent-ruby (1.1.
|
24
|
-
diff-lcs (1.
|
25
|
-
google-protobuf (3.
|
26
|
-
googleapis-common-protos-types (1.0.
|
27
|
-
google-protobuf (~> 3.
|
28
|
-
grpc (1.
|
29
|
-
google-protobuf (~> 3.
|
18
|
+
i18n (>= 1.6, < 2)
|
19
|
+
minitest (>= 5.1)
|
20
|
+
tzinfo (~> 2.0)
|
21
|
+
zeitwerk (~> 2.3)
|
22
|
+
ast (2.4.2)
|
23
|
+
concurrent-ruby (1.1.8)
|
24
|
+
diff-lcs (1.4.4)
|
25
|
+
google-protobuf (3.15.8)
|
26
|
+
googleapis-common-protos-types (1.0.6)
|
27
|
+
google-protobuf (~> 3.14)
|
28
|
+
grpc (1.37.1)
|
29
|
+
google-protobuf (~> 3.15)
|
30
30
|
googleapis-common-protos-types (~> 1.0)
|
31
|
-
i18n (1.8.
|
31
|
+
i18n (1.8.10)
|
32
32
|
concurrent-ruby (~> 1.0)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
minitest (5.14.4)
|
34
|
+
parallel (1.20.1)
|
35
|
+
parser (3.0.1.1)
|
36
|
+
ast (~> 2.4.1)
|
37
|
+
rack (2.2.3)
|
38
38
|
rainbow (3.0.0)
|
39
|
-
rake (13.0.
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
rspec-
|
44
|
-
rspec-
|
45
|
-
|
46
|
-
|
47
|
-
|
39
|
+
rake (13.0.3)
|
40
|
+
regexp_parser (2.1.1)
|
41
|
+
rexml (3.2.5)
|
42
|
+
rspec (3.10.0)
|
43
|
+
rspec-core (~> 3.10.0)
|
44
|
+
rspec-expectations (~> 3.10.0)
|
45
|
+
rspec-mocks (~> 3.10.0)
|
46
|
+
rspec-core (3.10.1)
|
47
|
+
rspec-support (~> 3.10.0)
|
48
|
+
rspec-expectations (3.10.1)
|
48
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-mocks (3.
|
50
|
+
rspec-support (~> 3.10.0)
|
51
|
+
rspec-mocks (3.10.2)
|
51
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.
|
53
|
-
rspec-support (3.
|
54
|
-
rubocop (
|
55
|
-
jaro_winkler (~> 1.5.1)
|
53
|
+
rspec-support (~> 3.10.0)
|
54
|
+
rspec-support (3.10.2)
|
55
|
+
rubocop (1.13.0)
|
56
56
|
parallel (~> 1.10)
|
57
|
-
parser (>=
|
57
|
+
parser (>= 3.0.0.0)
|
58
58
|
rainbow (>= 2.2.2, < 4.0)
|
59
|
+
regexp_parser (>= 1.8, < 3.0)
|
59
60
|
rexml
|
61
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
60
62
|
ruby-progressbar (~> 1.7)
|
61
|
-
unicode-display_width (>= 1.4.0, <
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
64
|
+
rubocop-ast (1.5.0)
|
65
|
+
parser (>= 3.0.1.1)
|
66
|
+
rubocop-bsm (0.5.9)
|
67
|
+
rubocop (~> 1.0)
|
68
|
+
rubocop-performance
|
69
|
+
rubocop-rails
|
70
|
+
rubocop-rake
|
71
|
+
rubocop-rspec
|
72
|
+
rubocop-performance (1.11.1)
|
73
|
+
rubocop (>= 1.7.0, < 2.0)
|
74
|
+
rubocop-ast (>= 0.4.0)
|
75
|
+
rubocop-rails (2.9.1)
|
76
|
+
activesupport (>= 4.2.0)
|
77
|
+
rack (>= 1.1)
|
78
|
+
rubocop (>= 0.90.0, < 2.0)
|
79
|
+
rubocop-rake (0.5.1)
|
80
|
+
rubocop
|
81
|
+
rubocop-rspec (2.3.0)
|
82
|
+
rubocop (~> 1.0)
|
83
|
+
rubocop-ast (>= 1.1.0)
|
84
|
+
ruby-progressbar (1.11.0)
|
85
|
+
tzinfo (2.0.4)
|
86
|
+
concurrent-ruby (~> 1.0)
|
87
|
+
unicode-display_width (2.0.0)
|
88
|
+
zeitwerk (2.4.2)
|
68
89
|
|
69
90
|
PLATFORMS
|
70
91
|
ruby
|
@@ -75,7 +96,7 @@ DEPENDENCIES
|
|
75
96
|
grpcx!
|
76
97
|
rake
|
77
98
|
rspec
|
78
|
-
rubocop
|
99
|
+
rubocop-bsm
|
79
100
|
|
80
101
|
BUNDLED WITH
|
81
102
|
2.1.4
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# grpcx
|
2
2
|
|
3
|
-
|
3
|
+
[![Test](https://github.com/bsm/grpcx/actions/workflows/test.yml/badge.svg)](https://github.com/bsm/grpcx/actions/workflows/test.yml)
|
4
4
|
|
5
|
+
Ruby gRPC extensions/helpers
|
5
6
|
|
6
7
|
# Grpcx::Server
|
7
8
|
|
@@ -12,7 +13,6 @@ Mixin for `GRPC::RpcServer`:
|
|
12
13
|
- instruments each request with `ActiveSupport::Notifications` (available as `process_action.grpc`, includes `service: 'package.name.ServiceName', action: 'underscored_action_name'` data)
|
13
14
|
- includes `ActiveSupport::Rescuable` and transforms most common `ActiveRecord::ActiveRecordError`-s into `GRPC::BadStatus` ones
|
14
15
|
|
15
|
-
|
16
16
|
Example:
|
17
17
|
|
18
18
|
```ruby
|
@@ -47,7 +47,6 @@ end
|
|
47
47
|
...
|
48
48
|
```
|
49
49
|
|
50
|
-
|
51
50
|
## Using with [Datadog::Notifications](https://github.com/bsm/datadog-notifications)
|
52
51
|
|
53
52
|
Since version >= [0.5.4](https://github.com/bsm/datadog-notifications/releases/tag/v0.5.4)
|
@@ -58,7 +57,6 @@ Datadog::Notifications.configure do |c|
|
|
58
57
|
end if RUNNING_IN_PROD?
|
59
58
|
```
|
60
59
|
|
61
|
-
|
62
60
|
## Using with [Sentry](https://sentry.io/)/[Raven](https://github.com/getsentry/raven-ruby)
|
63
61
|
|
64
62
|
```ruby
|
data/grpcx.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'grpcx'
|
3
|
-
s.version = '0.3.
|
3
|
+
s.version = '0.3.1'
|
4
4
|
s.authors = ['Black Square Media Ltd']
|
5
5
|
s.email = ['info@blacksquaremedia.com']
|
6
6
|
s.summary = %(gRPC extensions/helpers)
|
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_development_dependency 'bundler'
|
21
21
|
s.add_development_dependency 'rake'
|
22
22
|
s.add_development_dependency 'rspec'
|
23
|
-
s.add_development_dependency 'rubocop'
|
23
|
+
s.add_development_dependency 'rubocop-bsm'
|
24
24
|
end
|
data/lib/grpcx/server.rb
CHANGED
@@ -22,7 +22,7 @@ module Grpcx
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def initialize(opts
|
25
|
+
def initialize(**opts)
|
26
26
|
opts[:pool_size] ||= ENV['GRPC_SERVER_THREADS'].to_i if ENV['GRPC_SERVER_THREADS']
|
27
27
|
opts[:max_waiting_requests] ||= ENV['GRPC_SERVER_QUEUE'].to_i if ENV['GRPC_SERVER_QUEUE']
|
28
28
|
|
@@ -32,7 +32,7 @@ module Grpcx
|
|
32
32
|
opts[:interceptors].prepend Grpcx::Server::Interceptors::Instrumentation.new
|
33
33
|
opts[:interceptors].prepend Grpcx::Server::Interceptors::ActiveRecord.new if defined?(::ActiveRecord)
|
34
34
|
|
35
|
-
super
|
35
|
+
super.tap do
|
36
36
|
handle(health)
|
37
37
|
end
|
38
38
|
end
|
data/spec/lib/entity_spec.rb
CHANGED
data/spec/lib/server_spec.rb
CHANGED
@@ -7,7 +7,7 @@ RSpec.describe Grpcx::Server do
|
|
7
7
|
s
|
8
8
|
end
|
9
9
|
|
10
|
-
it '
|
10
|
+
it 'has a health-check' do
|
11
11
|
expect(subject.health).to be_a(Grpc::Health::Checker)
|
12
12
|
expect(subject.health.instance_variable_get(:@statuses)).to eq(
|
13
13
|
'grpcx.spec.service.V1' => 1,
|
@@ -15,14 +15,14 @@ RSpec.describe Grpcx::Server do
|
|
15
15
|
)
|
16
16
|
end
|
17
17
|
|
18
|
-
it '
|
18
|
+
it 'has interceptors' do
|
19
19
|
expect(subject.interceptors).to be_a(GRPC::InterceptorRegistry)
|
20
20
|
|
21
21
|
registered = subject.interceptors.instance_variable_get(:@interceptors)
|
22
22
|
expect(registered.size).to eq(3)
|
23
23
|
end
|
24
24
|
|
25
|
-
it '
|
25
|
+
it 'has rescue handlers' do
|
26
26
|
expect(subject.rescue_handlers.size).to eq(3)
|
27
27
|
expect(subject.rescue_handlers.map(&:first)).to match_array %w[
|
28
28
|
ActiveRecord::RecordInvalid
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grpcx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop
|
98
|
+
name: rubocop-bsm
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -116,6 +116,7 @@ extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
118
|
- ".editorconfig"
|
119
|
+
- ".github/workflows/test.yml"
|
119
120
|
- ".gitignore"
|
120
121
|
- ".rubocop.yml"
|
121
122
|
- Gemfile
|
@@ -152,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
153
|
- !ruby/object:Gem::Version
|
153
154
|
version: '0'
|
154
155
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.1.4
|
156
157
|
signing_key:
|
157
158
|
specification_version: 4
|
158
159
|
summary: gRPC extensions/helpers
|