Gruf both client and server interceptors, which report bugs to the Sentry.
gem "sentry-gruf"
bundle install
# --- or ---
gem install sentry-gruf
require "sentry-gruf"
After you install the gem, you need to set up the Sentry. You can read about Sentry configuration here.
Gem provides two interceptors for both client and server sides. All you need to add this interceptor at the beginning of interceptors stack.
For the server side, the installation will look something like this:
Gruf.configure do |config|
config.interceptors.clear # Like config.use_default_interceptors = false
config.interceptors.use(
Sentry::Gruf::ServerInterceptor,
sensitive_grpc_codes: [2, 5],
)
# Other interceptors go below.
end
where sensitive_grpc_codes is an optional array with codes of GRPC errors which will be reported to the Sentry.
And for the client side:
client = ::Gruf::Client.new(
service: Some::Service,
client_options: {
interceptors: [Sentry::Gruf::ClientInterceptor.new, OtherInterceptors.new]
}
)
Please note that the interceptor for the client itself does not send errors to Sentry. It simply tags some information about the last request made through the client.
- Fork it ( https://github.com/Cado-Labs/sentry-gruf )
- Create your feature branch (
git checkout -b feature/my-new-feature
) - Commit your changes (
git commit -am '[feature_context] Add some feature'
) - Push to the branch (
git push origin feature/my-new-feature
) - Create new Pull Request
Released under MIT License.
Created by Ivan Chernov.