sentry-gruf 1.0.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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +29 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +181 -0
- data/LICENSE.txt +21 -0
- data/README.md +73 -0
- data/Rakefile +35 -0
- data/bin/console +7 -0
- data/bin/setup +8 -0
- data/lib/sentry/gruf/client_interceptor.rb +31 -0
- data/lib/sentry/gruf/server_interceptor.rb +35 -0
- data/lib/sentry/gruf/version.rb +18 -0
- data/lib/sentry/gruf.rb +21 -0
- data/lib/sentry-gruf.rb +3 -0
- data/lib/sentry_gruf.rb +3 -0
- data/sentry_gruf.gemspec +34 -0
- metadata +89 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c6b92dcb88ee23c7a5ac67f55bc00b27116558e4135bc7b5958179756702f2f5
|
|
4
|
+
data.tar.gz: f3c6a5b296ec64663e3bff39ff6959a72562ef9cd9598d5052e6791fae7fa3dc
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d0532e245aaf46a75e95407713625942288b3a9199883b039b7ba12a50e80f0e29c1ded8a6bbdf0bde4f7de764fcde9ea974627bb53fa4d4eff7fee711219ee9
|
|
7
|
+
data.tar.gz: 45358ef5814848e11490f2801c362786e002364c182f60353bebcf26cd898fbcec843125d0643c384af61a63414f3af72b453853a21b2961c80aaef70cb40c9f
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
inherit_gem:
|
|
2
|
+
rubocop-config-umbrellio: lib/rubocop.yml
|
|
3
|
+
|
|
4
|
+
AllCops:
|
|
5
|
+
DisplayCopNames: true
|
|
6
|
+
TargetRubyVersion: 2.6
|
|
7
|
+
|
|
8
|
+
Naming/MethodParameterName:
|
|
9
|
+
AllowedNames: ["x", "y", "z"]
|
|
10
|
+
|
|
11
|
+
RSpec/EmptyLineAfterHook:
|
|
12
|
+
Enabled: false
|
|
13
|
+
|
|
14
|
+
Naming/FileName:
|
|
15
|
+
Exclude:
|
|
16
|
+
- lib/sentry-gruf.rb
|
|
17
|
+
|
|
18
|
+
Lint/RescueException:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
Style/NilLambda:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Naming/RescuedExceptionsVariableName:
|
|
25
|
+
PreferredName: e
|
|
26
|
+
|
|
27
|
+
Style/HashConversion:
|
|
28
|
+
Exclude:
|
|
29
|
+
- spec/**/*_spec.rb
|
data/Gemfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
# Specify your gem's dependencies in sentry_gruf.gemspec
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
gem "activesupport", "< 7.0.0"
|
|
9
|
+
gem "bundler"
|
|
10
|
+
gem "bundler-audit"
|
|
11
|
+
gem "ci-helper"
|
|
12
|
+
gem "pry"
|
|
13
|
+
gem "rake"
|
|
14
|
+
gem "rspec"
|
|
15
|
+
gem "rspec-json_matcher"
|
|
16
|
+
gem "rubocop-config-umbrellio"
|
|
17
|
+
gem "simplecov"
|
|
18
|
+
gem "simplecov-lcov"
|
|
19
|
+
gem "yard"
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
sentry-gruf (1.0.0)
|
|
5
|
+
gruf (~> 2.10.0)
|
|
6
|
+
sentry-ruby-core (~> 4.8.1)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activesupport (6.1.4.4)
|
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
13
|
+
i18n (>= 1.6, < 2)
|
|
14
|
+
minitest (>= 5.1)
|
|
15
|
+
tzinfo (~> 2.0)
|
|
16
|
+
zeitwerk (~> 2.3)
|
|
17
|
+
ast (2.4.2)
|
|
18
|
+
awesome_print (1.9.2)
|
|
19
|
+
bundler-audit (0.9.0.1)
|
|
20
|
+
bundler (>= 1.2.0, < 3)
|
|
21
|
+
thor (~> 1.0)
|
|
22
|
+
ci-helper (0.4.2)
|
|
23
|
+
colorize (~> 0.8)
|
|
24
|
+
dry-inflector (~> 0.2)
|
|
25
|
+
umbrellio-sequel-plugins (~> 0.4)
|
|
26
|
+
coderay (1.1.3)
|
|
27
|
+
colorize (0.8.1)
|
|
28
|
+
concurrent-ruby (1.1.9)
|
|
29
|
+
diff-lcs (1.4.4)
|
|
30
|
+
docile (1.4.0)
|
|
31
|
+
dry-inflector (0.2.1)
|
|
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)
|
|
43
|
+
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)
|
|
54
|
+
google-protobuf (~> 3.14)
|
|
55
|
+
grpc (1.42.0-x86_64-linux)
|
|
56
|
+
google-protobuf (~> 3.18)
|
|
57
|
+
googleapis-common-protos-types (~> 1.0)
|
|
58
|
+
grpc-tools (1.42.0)
|
|
59
|
+
gruf (2.10.0)
|
|
60
|
+
activesupport (> 4)
|
|
61
|
+
concurrent-ruby (> 1)
|
|
62
|
+
e2mmap (~> 0.1)
|
|
63
|
+
grpc (~> 1.10)
|
|
64
|
+
grpc-tools (~> 1.10)
|
|
65
|
+
json (>= 2.3)
|
|
66
|
+
slop (~> 4.6)
|
|
67
|
+
thwait (~> 0.1)
|
|
68
|
+
i18n (1.8.11)
|
|
69
|
+
concurrent-ruby (~> 1.0)
|
|
70
|
+
json (2.6.1)
|
|
71
|
+
method_source (1.0.0)
|
|
72
|
+
minitest (5.15.0)
|
|
73
|
+
multipart-post (2.1.1)
|
|
74
|
+
parallel (1.21.0)
|
|
75
|
+
parser (3.0.3.2)
|
|
76
|
+
ast (~> 2.4.1)
|
|
77
|
+
pry (0.14.1)
|
|
78
|
+
coderay (~> 1.1)
|
|
79
|
+
method_source (~> 1.0)
|
|
80
|
+
rack (2.2.3)
|
|
81
|
+
rainbow (3.0.0)
|
|
82
|
+
rake (13.0.6)
|
|
83
|
+
regexp_parser (2.2.0)
|
|
84
|
+
rexml (3.2.5)
|
|
85
|
+
rspec (3.10.0)
|
|
86
|
+
rspec-core (~> 3.10.0)
|
|
87
|
+
rspec-expectations (~> 3.10.0)
|
|
88
|
+
rspec-mocks (~> 3.10.0)
|
|
89
|
+
rspec-core (3.10.1)
|
|
90
|
+
rspec-support (~> 3.10.0)
|
|
91
|
+
rspec-expectations (3.10.1)
|
|
92
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
93
|
+
rspec-support (~> 3.10.0)
|
|
94
|
+
rspec-json_matcher (0.1.6)
|
|
95
|
+
awesome_print
|
|
96
|
+
json
|
|
97
|
+
rspec-mocks (3.10.2)
|
|
98
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
99
|
+
rspec-support (~> 3.10.0)
|
|
100
|
+
rspec-support (3.10.3)
|
|
101
|
+
rubocop (1.17.0)
|
|
102
|
+
parallel (~> 1.10)
|
|
103
|
+
parser (>= 3.0.0.0)
|
|
104
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
105
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
106
|
+
rexml
|
|
107
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
|
108
|
+
ruby-progressbar (~> 1.7)
|
|
109
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
110
|
+
rubocop-ast (1.15.0)
|
|
111
|
+
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)
|
|
121
|
+
rubocop-ast (>= 0.4.0)
|
|
122
|
+
rubocop-rails (2.9.1)
|
|
123
|
+
activesupport (>= 4.2.0)
|
|
124
|
+
rack (>= 1.1)
|
|
125
|
+
rubocop (>= 0.90.0, < 2.0)
|
|
126
|
+
rubocop-rake (0.5.1)
|
|
127
|
+
rubocop
|
|
128
|
+
rubocop-rspec (2.2.0)
|
|
129
|
+
rubocop (~> 1.0)
|
|
130
|
+
rubocop-ast (>= 1.1.0)
|
|
131
|
+
rubocop-sequel (0.2.0)
|
|
132
|
+
rubocop (~> 1.0)
|
|
133
|
+
ruby-progressbar (1.11.0)
|
|
134
|
+
ruby2_keywords (0.0.5)
|
|
135
|
+
sentry-ruby-core (4.8.1)
|
|
136
|
+
concurrent-ruby
|
|
137
|
+
faraday
|
|
138
|
+
sequel (5.51.0)
|
|
139
|
+
simplecov (0.21.2)
|
|
140
|
+
docile (~> 1.1)
|
|
141
|
+
simplecov-html (~> 0.11)
|
|
142
|
+
simplecov_json_formatter (~> 0.1)
|
|
143
|
+
simplecov-html (0.12.3)
|
|
144
|
+
simplecov-lcov (0.8.0)
|
|
145
|
+
simplecov_json_formatter (0.1.3)
|
|
146
|
+
slop (4.9.1)
|
|
147
|
+
symbiont-ruby (0.7.0)
|
|
148
|
+
thor (1.1.0)
|
|
149
|
+
thwait (0.2.0)
|
|
150
|
+
e2mmap
|
|
151
|
+
tzinfo (2.0.4)
|
|
152
|
+
concurrent-ruby (~> 1.0)
|
|
153
|
+
umbrellio-sequel-plugins (0.5.1.27)
|
|
154
|
+
sequel
|
|
155
|
+
symbiont-ruby
|
|
156
|
+
unicode-display_width (2.1.0)
|
|
157
|
+
webrick (1.7.0)
|
|
158
|
+
yard (0.9.27)
|
|
159
|
+
webrick (~> 1.7.0)
|
|
160
|
+
zeitwerk (2.5.1)
|
|
161
|
+
|
|
162
|
+
PLATFORMS
|
|
163
|
+
x86_64-linux
|
|
164
|
+
|
|
165
|
+
DEPENDENCIES
|
|
166
|
+
activesupport (< 7.0.0)
|
|
167
|
+
bundler
|
|
168
|
+
bundler-audit
|
|
169
|
+
ci-helper
|
|
170
|
+
pry
|
|
171
|
+
rake
|
|
172
|
+
rspec
|
|
173
|
+
rspec-json_matcher
|
|
174
|
+
rubocop-config-umbrellio
|
|
175
|
+
sentry-gruf!
|
|
176
|
+
simplecov
|
|
177
|
+
simplecov-lcov
|
|
178
|
+
yard
|
|
179
|
+
|
|
180
|
+
BUNDLED WITH
|
|
181
|
+
2.3.0
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 JustAnotherDude
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Sentry-Gruf · <a target="_blank" href="https://github.com/Cado-Labs"><img src="https://github.com/Cado-Labs/cado-labs-logos/raw/main/cado_labs_badge.svg" alt="Supported by Cado Labs" style="max-width: 100%; height: 20px"></a>
|
|
2
|
+
|
|
3
|
+
Gruf both client and server interceptors, which report bugs to the Sentry.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
gem "sentry-gruf"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
bundle install
|
|
13
|
+
# --- or ---
|
|
14
|
+
gem install sentry-gruf
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
require "sentry-gruf"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
After you install the gem, you need to set up the Sentry. You can read about Sentry
|
|
24
|
+
configuration [here](https://docs.sentry.io/platforms/ruby/).
|
|
25
|
+
|
|
26
|
+
Gem provides two interceptors for both client and server sides. All you need to add this interceptor
|
|
27
|
+
at the beginning of interceptors stack.
|
|
28
|
+
|
|
29
|
+
For the server side, the installation will look something like this:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
Gruf.configure do |config|
|
|
33
|
+
config.interceptors.clear # Like config.use_default_interceptors = false
|
|
34
|
+
config.interceptors.use(Sentry::Gruf::ServerInterceptor)
|
|
35
|
+
# Other interceptors go below.
|
|
36
|
+
end
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
And for the client side:
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
client = ::Gruf::Client.new(
|
|
43
|
+
service: Some::Service,
|
|
44
|
+
client_options: {
|
|
45
|
+
interceptors: [Sentry::Gruf::ClientInterceptor.new, OtherInterceptors.new]
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Please note that the interceptor for the client itself does not send errors to Sentry.
|
|
51
|
+
It simply tags some information about the last request made through the client.
|
|
52
|
+
|
|
53
|
+
### Contributing
|
|
54
|
+
|
|
55
|
+
- Fork it ( https://github.com/Cado-Labs/sentry-gruf )
|
|
56
|
+
- Create your feature branch (`git checkout -b feature/my-new-feature`)
|
|
57
|
+
- Commit your changes (`git commit -am '[feature_context] Add some feature'`)
|
|
58
|
+
- Push to the branch (`git push origin feature/my-new-feature`)
|
|
59
|
+
- Create new Pull Request
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
Released under MIT License.
|
|
64
|
+
|
|
65
|
+
## Supporting
|
|
66
|
+
|
|
67
|
+
<a href="https://github.com/Cado-Labs">
|
|
68
|
+
<img src="https://github.com/Cado-Labs/cado-labs-resources/blob/main/cado_labs_supporting_rounded.svg" alt="Supported by Cado Labs" />
|
|
69
|
+
</a>
|
|
70
|
+
|
|
71
|
+
## Authors
|
|
72
|
+
|
|
73
|
+
Created by [Ivan Chernov](https://github.com/AnotherRegularDude).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
require "rubocop/rake_task"
|
|
6
|
+
require "yard"
|
|
7
|
+
|
|
8
|
+
ROOT = Pathname.new(__FILE__).join("..")
|
|
9
|
+
|
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
11
|
+
RuboCop::RakeTask.new(:lint)
|
|
12
|
+
|
|
13
|
+
YARD::Rake::YardocTask.new(:doc) do |t|
|
|
14
|
+
t.files = Dir[ROOT.join("lib/**/*.rb")]
|
|
15
|
+
t.options = %w[--private]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
namespace :doc do
|
|
19
|
+
desc "Check documentation coverage"
|
|
20
|
+
task coverage: :doc do
|
|
21
|
+
YARD::Registry.load
|
|
22
|
+
objs = YARD::Registry.select do |o|
|
|
23
|
+
puts "pending #{o}" if /TODO|FIXME|@pending/.match?(o.docstring)
|
|
24
|
+
o.docstring.blank?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
next if objs.empty?
|
|
28
|
+
puts "No documentation found for:"
|
|
29
|
+
objs.each { |x| puts "\t#{x}" }
|
|
30
|
+
|
|
31
|
+
raise "100% document coverage required"
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
task default: %i[lint spec]
|
data/bin/console
ADDED
data/bin/setup
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sentry
|
|
4
|
+
module Gruf
|
|
5
|
+
# Interceptor for the Gruf client.
|
|
6
|
+
# Please note that the interceptor itself does not send errors to Sentry.
|
|
7
|
+
# It simply tags some information about the last request made through the client.
|
|
8
|
+
# Just add this interceptor to the array of used interceptors as the first element.
|
|
9
|
+
# @example Use client interceptor
|
|
10
|
+
# client = ::Gruf::Client.new(
|
|
11
|
+
# service: Some::Service,
|
|
12
|
+
# client_options: {
|
|
13
|
+
# interceptors: [Sentry::Gruf::ClientInterceptor.new, OtherInterceptors.new]
|
|
14
|
+
# }
|
|
15
|
+
# )
|
|
16
|
+
class ClientInterceptor < ::Gruf::Interceptors::ClientInterceptor
|
|
17
|
+
# @param request_context [Gruf::Outbound::RequestContext]
|
|
18
|
+
def call(request_context:)
|
|
19
|
+
::Sentry.configure_scope do |scope|
|
|
20
|
+
scope.set_tags(
|
|
21
|
+
grpc_method_name: request_context.method_name,
|
|
22
|
+
grpc_route_key: request_context.route_key,
|
|
23
|
+
grpc_call_type: request_context.type,
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
yield
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sentry
|
|
4
|
+
module Gruf
|
|
5
|
+
# Interceptor for Gruf wrapper of gRPC server.
|
|
6
|
+
# It handles all uncaught exceptions and sent them to the Sentry.
|
|
7
|
+
# Add this interceptor to the begining of interceptors stack.
|
|
8
|
+
# @example Use server interceptor
|
|
9
|
+
# Gruf.configure do |config|
|
|
10
|
+
# config.interceptors.clear
|
|
11
|
+
# config.interceptors.use(Sentry::Gruf::ServerInterceptor)
|
|
12
|
+
# end
|
|
13
|
+
class ServerInterceptor < ::Gruf::Interceptors::ServerInterceptor
|
|
14
|
+
# Required method by Gruf interceptor specification.
|
|
15
|
+
# @see https://rubydoc.info/gems/gruf/Gruf/Interceptors/ServerInterceptor Gruf documentation
|
|
16
|
+
# @yield Perform request logic
|
|
17
|
+
def call
|
|
18
|
+
yield
|
|
19
|
+
rescue Exception => e
|
|
20
|
+
::Sentry.configure_scope do |scope|
|
|
21
|
+
scope.set_transaction_name(request.service_key)
|
|
22
|
+
scope.set_tags(
|
|
23
|
+
grpc_method: request.method_key,
|
|
24
|
+
grpc_request_class: request.request_class.name,
|
|
25
|
+
grpc_service_key: request.service_key,
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
::Sentry::Gruf.capture_exception(e)
|
|
30
|
+
|
|
31
|
+
raise
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sentry
|
|
4
|
+
module Gruf
|
|
5
|
+
# Current gruf-sentry version
|
|
6
|
+
#
|
|
7
|
+
# format: 'a.b.c' with possible suffixes such as alpha
|
|
8
|
+
# * a is for major version, it is guaranteed to be changed
|
|
9
|
+
# if back-compatibility of public API is broken
|
|
10
|
+
# * b is for minor version, it is guaranteed to be changed
|
|
11
|
+
# on public API changes and also if private API
|
|
12
|
+
# back-compatibility is broken
|
|
13
|
+
# * c is for incremental version, it is updated in other cases
|
|
14
|
+
# According to this, it is enough to specify '~> a.b'
|
|
15
|
+
# if private API was not used and to specify '~> a.b.c' if it was
|
|
16
|
+
VERSION = "1.0.0"
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/sentry/gruf.rb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "gruf"
|
|
4
|
+
|
|
5
|
+
require "sentry-ruby"
|
|
6
|
+
require "sentry/integrable"
|
|
7
|
+
|
|
8
|
+
# Namespace, used by the `sentry-ruby-core` gem.
|
|
9
|
+
# @see https://rubydoc.info/gems/sentry-ruby-core Sentry documentation
|
|
10
|
+
module Sentry
|
|
11
|
+
# gruf-sentry is a library that provides both client-side and server-side interceptors
|
|
12
|
+
# that send uncaught error data to Sentry.
|
|
13
|
+
module Gruf
|
|
14
|
+
extend Integrable
|
|
15
|
+
register_integration name: "gruf", version: Sentry::Gruf::VERSION
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
require_relative "gruf/version"
|
|
20
|
+
require_relative "gruf/server_interceptor"
|
|
21
|
+
require_relative "gruf/client_interceptor"
|
data/lib/sentry-gruf.rb
ADDED
data/lib/sentry_gruf.rb
ADDED
data/sentry_gruf.gemspec
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/sentry/gruf/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "sentry-gruf"
|
|
7
|
+
spec.version = Sentry::Gruf::VERSION
|
|
8
|
+
spec.authors = ["JustAnotherDude"]
|
|
9
|
+
spec.email = ["vanyaz158@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Gruf both client and server interceptors, which report bugs to the Sentry."
|
|
12
|
+
spec.description = "Gruf both client and server interceptors, which report bugs to the Sentry."
|
|
13
|
+
spec.homepage = "https://github.com/orgs/Cado-Labs"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
|
16
|
+
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/orgs/Cado-Labs"
|
|
19
|
+
|
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
24
|
+
(f == __FILE__) ||
|
|
25
|
+
f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
spec.bindir = "exe"
|
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
|
|
32
|
+
spec.add_dependency "gruf", "~> 2.10.0"
|
|
33
|
+
spec.add_dependency "sentry-ruby-core", "~> 4.8.1"
|
|
34
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sentry-gruf
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- JustAnotherDude
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-12-23 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: gruf
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 2.10.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 2.10.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: sentry-ruby-core
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 4.8.1
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 4.8.1
|
|
41
|
+
description: Gruf both client and server interceptors, which report bugs to the Sentry.
|
|
42
|
+
email:
|
|
43
|
+
- vanyaz158@gmail.com
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- ".rspec"
|
|
49
|
+
- ".rubocop.yml"
|
|
50
|
+
- Gemfile
|
|
51
|
+
- Gemfile.lock
|
|
52
|
+
- LICENSE.txt
|
|
53
|
+
- README.md
|
|
54
|
+
- Rakefile
|
|
55
|
+
- bin/console
|
|
56
|
+
- bin/setup
|
|
57
|
+
- lib/sentry-gruf.rb
|
|
58
|
+
- lib/sentry/gruf.rb
|
|
59
|
+
- lib/sentry/gruf/client_interceptor.rb
|
|
60
|
+
- lib/sentry/gruf/server_interceptor.rb
|
|
61
|
+
- lib/sentry/gruf/version.rb
|
|
62
|
+
- lib/sentry_gruf.rb
|
|
63
|
+
- sentry_gruf.gemspec
|
|
64
|
+
homepage: https://github.com/orgs/Cado-Labs
|
|
65
|
+
licenses:
|
|
66
|
+
- MIT
|
|
67
|
+
metadata:
|
|
68
|
+
homepage_uri: https://github.com/orgs/Cado-Labs
|
|
69
|
+
source_code_uri: https://github.com/orgs/Cado-Labs
|
|
70
|
+
post_install_message:
|
|
71
|
+
rdoc_options: []
|
|
72
|
+
require_paths:
|
|
73
|
+
- lib
|
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
|
+
requirements:
|
|
76
|
+
- - ">="
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
version: 2.6.0
|
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0'
|
|
84
|
+
requirements: []
|
|
85
|
+
rubygems_version: 3.3.0
|
|
86
|
+
signing_key:
|
|
87
|
+
specification_version: 4
|
|
88
|
+
summary: Gruf both client and server interceptors, which report bugs to the Sentry.
|
|
89
|
+
test_files: []
|