gruf-sentry 1.0.1 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41b5b045df57bd388ad5e01f0679a20d5a3ca18d2b426f698860b470e721dc20
4
- data.tar.gz: 0b3e8804eee42ee53b663a3425d6f17d00218684677c92c966f139f4aae92a0b
3
+ metadata.gz: a8f10ec71ba89c2017838ec9e941e6c5354a5c0a1b0a0e05bc8ef8848c3f5474
4
+ data.tar.gz: e033a3f5aa0bd78cf8a2c037e96f4ef150f2c0378776b2d752b30a01befdb01e
5
5
  SHA512:
6
- metadata.gz: d3ee1303ee5acab3ffd5c929753081f5de7d3683c5d9ba01b3f8a015beddbe9f3142e4573d59335bbeb6c946c3893ae855a72c7f54c9efe184d2c20d67cdfa3e
7
- data.tar.gz: 1ca6eae6cb90137edaab55b42627055413f43d967fb515b57784e601ef9c4703a1069d01321b95bbc96987c085a3fed1b90dbf9d29db2f7103b7a55646c77047
6
+ metadata.gz: 1cf64ae2a61837767c73775b613a3ad00e578dd8e76956180a12b75f78443c63cf6612f044ae713d1ae0d61c8ea12581a2638740c5db6bc624ef5364d94fd429
7
+ data.tar.gz: c9ee9ba9753a5c7f36a0945d1a3bc9342c2476013e1e1299dba4b6d496fec3894bb80f3fa50cff732445fc3f8d14773b6e6a2851185a315e060353836f715669
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@ Changelog for the gruf-sentry gem.
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 1.3.0
6
+
7
+ - Upgrade to sentry-ruby 5.x
8
+
9
+ ### 1.2.0
10
+
11
+ - Add Ruby 3.1 support
12
+ - Drop Ruby 2.6 support
13
+
14
+ ### 1.1.0
15
+
16
+ - Update Gruf::Sentry::ClientInterceptor for new sentry-ruby format
17
+
5
18
  ### 1.0.1
6
19
 
7
20
  - Update Sentry.capture_exception to work with new sentry-ruby format
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # gruf-sentry - Sentry reporting for gruf
2
2
 
3
- [![CircleCI](https://circleci.com/gh/bigcommerce/gruf-sentry/tree/main.svg?style=svg)](https://circleci.com/gh/bigcommerce/gruf-sentry/tree/main) [![Gem Version](https://badge.fury.io/rb/gruf-sentry.svg)](https://badge.fury.io/rb/gruf-sentry) [![Inline docs](http://inch-ci.org/github/bigcommerce/gruf-sentry.svg?branch=main)](http://inch-ci.org/github/bigcommerce/gruf-sentry)
3
+ [![CircleCI](https://circleci.com/gh/bigcommerce/gruf-sentry/tree/main.svg?style=svg)](https://circleci.com/gh/bigcommerce/gruf-sentry/tree/main) [![Gem Version](https://badge.fury.io/rb/gruf-sentry.svg)](https://badge.fury.io/rb/gruf-sentry) [![Inline docs](http://inch-ci.org/github/bigcommerce/gruf-sentry.svg?branch=main)](http://inch-ci.org/github/bigcommerce/gruf-sentry) [![Maintainability](https://api.codeclimate.com/v1/badges/530757a403a4a596dda0/maintainability)](https://codeclimate.com/github/bigcommerce/gruf-sentry/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/530757a403a4a596dda0/test_coverage)](https://codeclimate.com/github/bigcommerce/gruf-sentry/test_coverage)
4
4
 
5
- Adds Sentry error reporting support for [gruf](https://github.com/bigcommerce/gruf) 2.7.0+.
5
+ Adds Sentry error reporting support for [gruf](https://github.com/bigcommerce/gruf) 2.7.0+
6
+ and [sentry-ruby](https://github.com/getsentry/sentry-ruby) 4.3+.
6
7
 
7
8
  This gem will automatically report grpc failures and Gruf errors into Sentry as they happen in servers and clients.
8
9
 
@@ -24,9 +25,11 @@ end
24
25
 
25
26
  It comes with a few more options as well:
26
27
 
27
- | Option | Description | Default |
28
- | ------ | ----------- | ------- |
29
- | ignore_methods | An array of method names to ignore from logging. E.g. `['namespace.health.check']` | `[]` |
28
+ | Option | Description | Default | ENV Key |
29
+ |--------------------|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
30
+ | ignore_methods | A list of method names to ignore from logging. E.g. `['namespace.health.check']` | `[]` | GRUF_SENTRY_IGNORE_METHODS |
31
+ | grpc_error_classes | A list of gRPC error classes that will be used for detecting errors (as opposed to validation) | `GRPC::Unknown,GRPC::Internal,GRPC::DataLoss,GRPC::FailedPrecondition,GRPC::Unavailable,GRPC::DeadlineExceeded,GRPC::Cancelled` | GRUF_SENTRY_GRPC_ERROR_CLASSES |
32
+ | default_error_code | The default gRPC error code to use (int value) | `GRPC::Core::StatusCodes::INTERNAL` | `GRUF_SENTRY_DEFAULT_ERROR_CODE` |
30
33
 
31
34
  ### Client Interceptors
32
35
 
@@ -43,17 +46,17 @@ Gruf::Client.new(
43
46
 
44
47
  ## License
45
48
 
46
- Copyright (c) 2020-present, BigCommerce Pty. Ltd. All rights reserved
49
+ Copyright (c) 2020-present, BigCommerce Pty. Ltd. All rights reserved
47
50
 
48
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
49
- documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
50
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
51
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
52
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
53
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
51
54
  persons to whom the Software is furnished to do so, subject to the following conditions:
52
55
 
53
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
56
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
54
57
  Software.
55
58
 
56
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
57
- WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
58
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
59
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
60
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
61
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
59
62
  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/gruf-sentry.gemspec CHANGED
@@ -15,7 +15,7 @@
15
15
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
16
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
17
  #
18
- lib = File.expand_path('../lib', __FILE__)
18
+ lib = File.expand_path('lib', __dir__)
19
19
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
20
20
  require 'gruf/sentry/version'
21
21
 
@@ -30,19 +30,20 @@ Gem::Specification.new do |spec|
30
30
  spec.description = spec.summary
31
31
  spec.homepage = 'https://github.com/bigcommerce/gruf-sentry'
32
32
 
33
- spec.required_ruby_version = '>= 2.6'
33
+ spec.required_ruby_version = '>= 2.7'
34
34
 
35
35
  spec.files = Dir['README.md', 'CHANGELOG.md', 'CODE_OF_CONDUCT.md', 'lib/**/*', 'gruf-sentry.gemspec']
36
36
  spec.require_paths = ['lib']
37
37
 
38
- spec.add_development_dependency 'bundler-audit', '~> 0.6'
38
+ spec.add_development_dependency 'bundler-audit', '>= 0.6'
39
39
  spec.add_development_dependency 'rake', '>= 12.3'
40
- spec.add_development_dependency 'rubocop', '>= 1'
41
- spec.add_development_dependency 'pry', '~> 0.14'
40
+ spec.add_development_dependency 'rubocop', '>= 1.27'
41
+ spec.add_development_dependency 'pry', '>= 0.14'
42
42
  spec.add_development_dependency 'rspec', '>= 3.8'
43
43
  spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
44
44
  spec.add_development_dependency 'simplecov', '>= 0.16'
45
45
 
46
- spec.add_dependency 'gruf', '~> 2.5', '>= 2.5.1'
47
- spec.add_dependency 'sentry-ruby', '~> 4.3'
46
+ spec.add_runtime_dependency 'gruf', '~> 2.5', '>= 2.5.1'
47
+ spec.add_runtime_dependency 'sentry-ruby', '>= 5.0'
48
+ spec.add_runtime_dependency 'zeitwerk', '~> 2'
48
49
  end
@@ -33,17 +33,15 @@ module Gruf
33
33
  yield
34
34
  rescue StandardError, GRPC::BadStatus => e
35
35
  if error?(e) # only capture
36
- ::Sentry.capture_exception(
37
- e,
38
- message: e.message,
39
- extra: {
40
- grpc_method_name: request_context.method_name,
41
- grpc_route_key: request_context.route_key,
42
- grpc_call_type: request_context.type,
43
- grpc_error_code: code_for(e),
44
- grpc_error_class: e.class
45
- }
46
- )
36
+ ::Sentry.configure_scope do |scope|
37
+ scope.set_transaction_name(request_context.route_key)
38
+ scope.set_tags(grpc_method_name: request_context.method_name,
39
+ grpc_route_key: request_context.route_key,
40
+ grpc_call_type: request_context.type,
41
+ grpc_error_code: code_for(e),
42
+ grpc_error_class: e.class.name)
43
+ end
44
+ ::Sentry.capture_exception(e)
47
45
  end
48
46
  raise # passthrough
49
47
  end
@@ -17,6 +17,6 @@
17
17
  #
18
18
  module Gruf
19
19
  module Sentry
20
- VERSION = '1.0.1'
20
+ VERSION = '1.3.0'
21
21
  end
22
22
  end
data/lib/gruf/sentry.rb CHANGED
@@ -17,14 +17,19 @@
17
17
  #
18
18
  require 'gruf'
19
19
  require 'sentry-ruby'
20
+
20
21
  # backwards-compatibly patch for sentry-raven users
21
22
  ::Raven = ::Sentry unless defined?(::Raven)
22
23
 
23
- require_relative 'sentry/version'
24
- require_relative 'sentry/configuration'
25
- require_relative 'sentry/error_parser'
26
- require_relative 'sentry/server_interceptor'
27
- require_relative 'sentry/client_interceptor'
24
+ # use Zeitwerk to lazily autoload all the files in the lib directory
25
+ require 'zeitwerk'
26
+ root_path = File.dirname(__dir__)
27
+ loader = ::Zeitwerk::Loader.new
28
+ loader.tag = File.basename(__FILE__, '.rb')
29
+ loader.inflector = ::Zeitwerk::GemInflector.new(__FILE__)
30
+ loader.ignore(File.join(root_path, 'gruf-sentry.rb'))
31
+ loader.push_dir(root_path)
32
+ loader.setup
28
33
 
29
34
  ##
30
35
  # Base gruf module
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2020-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
+ require_relative 'gruf/sentry'
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf-sentry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.3.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: 2021-05-20 00:00:00.000000000 Z
11
+ date: 2022-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.6'
27
27
  - !ruby/object:Gem::Dependency
@@ -44,26 +44,26 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1'
47
+ version: '1.27'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1'
54
+ version: '1.27'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.14'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.14'
69
69
  - !ruby/object:Gem::Dependency
@@ -130,18 +130,32 @@ dependencies:
130
130
  version: 2.5.1
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: sentry-ruby
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '5.0'
138
+ type: :runtime
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '5.0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: zeitwerk
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - "~>"
136
150
  - !ruby/object:Gem::Version
137
- version: '4.3'
151
+ version: '2'
138
152
  type: :runtime
139
153
  prerelease: false
140
154
  version_requirements: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - "~>"
143
157
  - !ruby/object:Gem::Version
144
- version: '4.3'
158
+ version: '2'
145
159
  description: Automatically report gruf failures as sentry errors
146
160
  email:
147
161
  - splittingred@gmail.com
@@ -153,6 +167,7 @@ files:
153
167
  - CODE_OF_CONDUCT.md
154
168
  - README.md
155
169
  - gruf-sentry.gemspec
170
+ - lib/gruf-sentry.rb
156
171
  - lib/gruf/sentry.rb
157
172
  - lib/gruf/sentry/client_interceptor.rb
158
173
  - lib/gruf/sentry/configuration.rb
@@ -171,14 +186,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
186
  requirements:
172
187
  - - ">="
173
188
  - !ruby/object:Gem::Version
174
- version: '2.6'
189
+ version: '2.7'
175
190
  required_rubygems_version: !ruby/object:Gem::Requirement
176
191
  requirements:
177
192
  - - ">="
178
193
  - !ruby/object:Gem::Version
179
194
  version: '0'
180
195
  requirements: []
181
- rubygems_version: 3.0.9
196
+ rubygems_version: 3.3.4
182
197
  signing_key:
183
198
  specification_version: 4
184
199
  summary: Automatically report gruf failures as sentry errors