sentry-gruf 1.0.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24ff0c577e744986e81a26dbdc2cf376d3ad0d909c79d96068df030ab4dec855
4
- data.tar.gz: e1c182989769d24173a8569207564ae6c1f0f2f4f7f1d3b2d6a06c1c9132d9a5
3
+ metadata.gz: 5a91b26a44afd5300f91475066741f880497ef1686a52365ab27f19a7ece14ae
4
+ data.tar.gz: 8c83ed9c1fb3c605c7285325b11a1cca7875f8e296b1b89c4c1121769763face
5
5
  SHA512:
6
- metadata.gz: 67a6ac9f50e356a19e03a7b7d5e90f83f0482eac6b59334fdca63f1f42a8c0a6a5bcef049d54402e0471e616e09a440196163420a3a26e112356e0ab8cdd41d6
7
- data.tar.gz: 7bf588cd1b376d75e3c0ca378c152c26a1383dae3ed0ee2cba89275cb6a18323194958b35326883beacbd5eb65e7f7e6b029c82b639a7fe44dc65a47e1968519
6
+ metadata.gz: 2fe55d9f734759e141d1b37d75876b68e628d9050088bce4fd28244ec29141e58c55ca7191213f860406107bc4b040314d43a1b466dba1cb8263eb367120616a
7
+ data.tar.gz: 4cac9f51289a78fa17636e793aa58bdc3c0eeb826270858996c9bfc2f77d5a3d102b3f808366b60448e5db2021a2cac607c7563c24dd7289f306cbf1c27dbf77
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_gem:
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 2.6
6
+ TargetRubyVersion: 2.7
7
7
 
8
8
  Naming/MethodParameterName:
9
9
  AllowedNames: ["x", "y", "z"]
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sentry-gruf (1.0.2)
5
- gruf (~> 2.10)
4
+ sentry-gruf (1.2.0)
5
+ gruf (~> 2.12)
6
6
  sentry-ruby-core (~> 4.8)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (6.1.4.4)
11
+ activesupport (6.1.7.3)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 1.6, < 2)
14
14
  minitest (>= 5.1)
@@ -25,60 +25,50 @@ GEM
25
25
  umbrellio-sequel-plugins (~> 0.4)
26
26
  coderay (1.1.3)
27
27
  colorize (0.8.1)
28
- concurrent-ruby (1.1.9)
29
- diff-lcs (1.4.4)
28
+ concurrent-ruby (1.2.2)
29
+ diff-lcs (1.5.0)
30
30
  docile (1.4.0)
31
31
  dry-inflector (0.2.1)
32
32
  e2mmap (0.1.0)
33
- faraday (1.8.0)
34
- faraday-em_http (~> 1.0)
35
- faraday-em_synchrony (~> 1.0)
36
- faraday-excon (~> 1.1)
37
- faraday-httpclient (~> 1.0.1)
38
- faraday-net_http (~> 1.0)
39
- faraday-net_http_persistent (~> 1.1)
40
- faraday-patron (~> 1.0)
41
- faraday-rack (~> 1.0)
42
- multipart-post (>= 1.2, < 3)
33
+ faraday (2.7.4)
34
+ faraday-net_http (>= 2.0, < 3.1)
43
35
  ruby2_keywords (>= 0.0.4)
44
- faraday-em_http (1.0.0)
45
- faraday-em_synchrony (1.0.0)
46
- faraday-excon (1.1.0)
47
- faraday-httpclient (1.0.1)
48
- faraday-net_http (1.0.1)
49
- faraday-net_http_persistent (1.2.0)
50
- faraday-patron (1.0.0)
51
- faraday-rack (1.0.0)
52
- google-protobuf (3.19.1-x86_64-linux)
53
- googleapis-common-protos-types (1.3.0)
36
+ faraday-net_http (3.0.2)
37
+ google-protobuf (3.22.2)
38
+ google-protobuf (3.22.2-arm64-darwin)
39
+ google-protobuf (3.22.2-x86_64-linux)
40
+ googleapis-common-protos-types (1.5.0)
54
41
  google-protobuf (~> 3.14)
55
- grpc (1.41.0-x86_64-linux)
56
- google-protobuf (~> 3.17)
42
+ grpc (1.53.0)
43
+ google-protobuf (~> 3.21)
57
44
  googleapis-common-protos-types (~> 1.0)
58
- grpc-tools (1.41.0)
59
- gruf (2.11.0)
45
+ grpc (1.53.0-x86_64-linux)
46
+ google-protobuf (~> 3.21)
47
+ googleapis-common-protos-types (~> 1.0)
48
+ grpc-tools (1.53.0)
49
+ gruf (2.17.0)
60
50
  activesupport (> 4)
61
51
  concurrent-ruby (> 1)
62
52
  e2mmap (>= 0.1)
63
- grpc (~> 1.10, <= 1.41.0)
64
- grpc-tools (~> 1.10, <= 1.41.0)
53
+ grpc (~> 1.10)
54
+ grpc-tools (~> 1.10)
65
55
  json (>= 2.3)
66
56
  slop (>= 4.6)
67
57
  thwait (>= 0.1)
68
- i18n (1.8.11)
58
+ zeitwerk (>= 2)
59
+ i18n (1.12.0)
69
60
  concurrent-ruby (~> 1.0)
70
- json (2.6.1)
61
+ json (2.6.3)
71
62
  method_source (1.0.0)
72
- minitest (5.15.0)
73
- multipart-post (2.1.1)
63
+ minitest (5.18.0)
74
64
  parallel (1.21.0)
75
- parser (3.0.3.2)
65
+ parser (3.1.0.0)
76
66
  ast (~> 2.4.1)
77
67
  pry (0.14.1)
78
68
  coderay (~> 1.1)
79
69
  method_source (~> 1.0)
80
- rack (2.2.3)
81
- rainbow (3.0.0)
70
+ rack (3.0.7)
71
+ rainbow (3.1.1)
82
72
  rake (13.0.6)
83
73
  regexp_parser (2.2.0)
84
74
  rexml (3.2.5)
@@ -98,44 +88,43 @@ GEM
98
88
  diff-lcs (>= 1.2.0, < 2.0)
99
89
  rspec-support (~> 3.10.0)
100
90
  rspec-support (3.10.3)
101
- rubocop (1.17.0)
91
+ rubocop (1.24.0)
102
92
  parallel (~> 1.10)
103
93
  parser (>= 3.0.0.0)
104
94
  rainbow (>= 2.2.2, < 4.0)
105
95
  regexp_parser (>= 1.8, < 3.0)
106
96
  rexml
107
- rubocop-ast (>= 1.7.0, < 2.0)
97
+ rubocop-ast (>= 1.15.0, < 2.0)
108
98
  ruby-progressbar (~> 1.7)
109
99
  unicode-display_width (>= 1.4.0, < 3.0)
110
- rubocop-ast (1.15.0)
100
+ rubocop-ast (1.15.1)
111
101
  parser (>= 3.0.1.1)
112
- rubocop-config-umbrellio (1.17.0.53)
113
- rubocop (= 1.17.0)
114
- rubocop-performance (= 1.10.0)
115
- rubocop-rails (= 2.9.1)
116
- rubocop-rake (= 0.5.1)
117
- rubocop-rspec (= 2.2.0)
118
- rubocop-sequel (= 0.2.0)
119
- rubocop-performance (1.10.0)
120
- rubocop (>= 0.90.0, < 2.0)
102
+ rubocop-config-umbrellio (1.24.0.56)
103
+ rubocop (= 1.24.0)
104
+ rubocop-performance (= 1.13.0)
105
+ rubocop-rails (= 2.13.0)
106
+ rubocop-rake (= 0.6.0)
107
+ rubocop-rspec (= 2.7.0)
108
+ rubocop-sequel (= 0.3.3)
109
+ rubocop-performance (1.13.0)
110
+ rubocop (>= 1.7.0, < 2.0)
121
111
  rubocop-ast (>= 0.4.0)
122
- rubocop-rails (2.9.1)
112
+ rubocop-rails (2.13.0)
123
113
  activesupport (>= 4.2.0)
124
114
  rack (>= 1.1)
125
- rubocop (>= 0.90.0, < 2.0)
126
- rubocop-rake (0.5.1)
127
- rubocop
128
- rubocop-rspec (2.2.0)
115
+ rubocop (>= 1.7.0, < 2.0)
116
+ rubocop-rake (0.6.0)
129
117
  rubocop (~> 1.0)
130
- rubocop-ast (>= 1.1.0)
131
- rubocop-sequel (0.2.0)
118
+ rubocop-rspec (2.7.0)
119
+ rubocop (~> 1.19)
120
+ rubocop-sequel (0.3.3)
132
121
  rubocop (~> 1.0)
133
122
  ruby-progressbar (1.11.0)
134
123
  ruby2_keywords (0.0.5)
135
- sentry-ruby-core (4.8.1)
124
+ sentry-ruby-core (4.9.2)
136
125
  concurrent-ruby
137
126
  faraday
138
- sequel (5.51.0)
127
+ sequel (5.52.0)
139
128
  simplecov (0.21.2)
140
129
  docile (~> 1.1)
141
130
  simplecov-html (~> 0.11)
@@ -143,12 +132,12 @@ GEM
143
132
  simplecov-html (0.12.3)
144
133
  simplecov-lcov (0.8.0)
145
134
  simplecov_json_formatter (0.1.3)
146
- slop (4.9.1)
135
+ slop (4.10.1)
147
136
  symbiont-ruby (0.7.0)
148
- thor (1.1.0)
137
+ thor (1.2.1)
149
138
  thwait (0.2.0)
150
139
  e2mmap
151
- tzinfo (2.0.4)
140
+ tzinfo (2.0.6)
152
141
  concurrent-ruby (~> 1.0)
153
142
  umbrellio-sequel-plugins (0.5.1.27)
154
143
  sequel
@@ -157,9 +146,11 @@ GEM
157
146
  webrick (1.7.0)
158
147
  yard (0.9.27)
159
148
  webrick (~> 1.7.0)
160
- zeitwerk (2.5.1)
149
+ zeitwerk (2.6.7)
161
150
 
162
151
  PLATFORMS
152
+ arm64-darwin-21
153
+ ruby
163
154
  x86_64-linux
164
155
 
165
156
  DEPENDENCIES
@@ -178,4 +169,4 @@ DEPENDENCIES
178
169
  yard
179
170
 
180
171
  BUNDLED WITH
181
- 2.3.0
172
+ 2.4.10
data/README.md CHANGED
@@ -31,10 +31,14 @@ For the server side, the installation will look something like this:
31
31
  ```ruby
32
32
  Gruf.configure do |config|
33
33
  config.interceptors.clear # Like config.use_default_interceptors = false
34
- config.interceptors.use(Sentry::Gruf::ServerInterceptor)
34
+ config.interceptors.use(
35
+ Sentry::Gruf::ServerInterceptor,
36
+ sensitive_grpc_codes: [2, 5],
37
+ )
35
38
  # Other interceptors go below.
36
39
  end
37
40
  ```
41
+ where sensitive_grpc_codes is an optional array with codes of GRPC errors which will be reported to the Sentry.
38
42
 
39
43
  And for the client side:
40
44
 
@@ -15,20 +15,29 @@ module Sentry
15
15
  # @see https://rubydoc.info/gems/gruf/Gruf/Interceptors/ServerInterceptor Gruf documentation
16
16
  # @yield Perform request logic
17
17
  def call
18
- yield
19
- rescue Exception => e
20
- ::Sentry.configure_scope do |scope|
18
+ # make sure the current thread has a clean hub
19
+ Sentry.clone_hub_to_current_thread
20
+
21
+ Sentry.with_scope do |scope|
22
+ scope.clear_breadcrumbs
21
23
  scope.set_transaction_name(request.service_key)
22
24
  scope.set_tags(
23
25
  grpc_method: request.method_key,
24
26
  grpc_request_class: request.request_class.name,
25
27
  grpc_service_key: request.service_key,
26
28
  )
27
- end
28
29
 
29
- ::Sentry::Gruf.capture_exception(e)
30
+ begin
31
+ yield
32
+ rescue Exception => e
33
+ sensitive_grpc_codes = options[:sensitive_grpc_codes] || []
34
+ raise if e.is_a?(GRPC::BadStatus) && !sensitive_grpc_codes.include?(e.code.to_s)
30
35
 
31
- raise
36
+ ::Sentry::Gruf.capture_exception(e)
37
+
38
+ raise
39
+ end
40
+ end
32
41
  end
33
42
  end
34
43
  end
@@ -13,6 +13,6 @@ module Sentry
13
13
  # * c is for incremental version, it is updated in other cases
14
14
  # According to this, it is enough to specify '~> a.b'
15
15
  # if private API was not used and to specify '~> a.b.c' if it was
16
- VERSION = "1.0.2"
16
+ VERSION = "1.2.0"
17
17
  end
18
18
  end
data/sentry_gruf.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Gruf both client and server interceptors, which report bugs to the Sentry."
13
13
  spec.homepage = "https://github.com/Cado-Labs/sentry-gruf"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
15
+ spec.required_ruby_version = ">= 2.7.0"
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/Cado-Labs/sentry-gruf"
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_dependency "gruf", "~> 2.10"
32
+ spec.add_dependency "gruf", "~> 2.12"
33
33
  spec.add_dependency "sentry-ruby-core", "~> 4.8"
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-gruf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JustAnotherDude
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-24 00:00:00.000000000 Z
11
+ date: 2023-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gruf
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.10'
19
+ version: '2.12'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.10'
26
+ version: '2.12'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sentry-ruby-core
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -75,14 +75,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
76
  - - ">="
77
77
  - !ruby/object:Gem::Version
78
- version: 2.6.0
78
+ version: 2.7.0
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 3.3.0
85
+ rubygems_version: 3.4.10
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Gruf both client and server interceptors, which report bugs to the Sentry.