Skip to content

Gruf both client and server interceptors, which report bugs to the Sentry

License

Notifications You must be signed in to change notification settings

Cado-Labs/sentry-gruf

Repository files navigation

Sentry-Gruf · Supported by Cado Labs · Gem Version · Coverage Status

Gruf both client and server interceptors, which report bugs to the Sentry.

Installation

gem "sentry-gruf"
bundle install
# --- or ---
gem install sentry-gruf
require "sentry-gruf"

Usage

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.

Contributing

  • 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

License

Released under MIT License.

Supporting

Supported by Cado Labs

Authors

Created by Ivan Chernov.