File tree Expand file tree Collapse file tree 8 files changed +70
-0
lines changed Expand file tree Collapse file tree 8 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 3030 run : bundle exec ci-helper RunSpecs
3131 - name : Audit
3232 run : bundle exec ci-helper BundlerAudit
33+ - name : Documentation coverage
34+ run : bundle exec rake doc:coverage
3335 - name : Coveralls
3436 uses : coverallsapp/github-action@master
3537 with :
Original file line number Diff line number Diff line change @@ -16,3 +16,4 @@ gem "rspec-json_matcher"
1616gem "rubocop-config-umbrellio"
1717gem "simplecov"
1818gem "simplecov-lcov"
19+ gem "yard"
Original file line number Diff line number Diff line change 154154 sequel
155155 symbiont-ruby
156156 unicode-display_width (2.1.0 )
157+ webrick (1.7.0 )
158+ yard (0.9.27 )
159+ webrick (~> 1.7.0 )
157160 zeitwerk (2.5.1 )
158161
159162PLATFORMS
@@ -172,6 +175,7 @@ DEPENDENCIES
172175 sentry-gruf !
173176 simplecov
174177 simplecov-lcov
178+ yard
175179
176180BUNDLED WITH
177181 2.3.0
Original file line number Diff line number Diff line change 33require "bundler/gem_tasks"
44require "rspec/core/rake_task"
55require "rubocop/rake_task"
6+ require "yard"
7+
8+ ROOT = Pathname . new ( __FILE__ ) . join ( ".." )
69
710RSpec ::Core ::RakeTask . new ( :spec )
811RuboCop ::RakeTask . new ( :lint )
912
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+
1035task default : %i[ lint spec ]
Original file line number Diff line number Diff line change 55require "sentry-ruby"
66require "sentry/integrable"
77
8+ # Namespace, used by the `sentry-ruby-core` gem.
9+ # @see https://rubydoc.info/gems/sentry-ruby-core Sentry documentation
810module Sentry
11+ # gruf-sentry is a library that provides both client-side and server-side interceptors
12+ # that send uncaught error data to Sentry.
913 module Gruf
1014 extend Integrable
1115 register_integration name : "gruf" , version : Sentry ::Gruf ::VERSION
Original file line number Diff line number Diff line change 22
33module Sentry
44 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+ # )
516 class ClientInterceptor < ::Gruf ::Interceptors ::ClientInterceptor
17+ # @param request_context [Gruf::Outbound::RequestContext]
618 def call ( request_context :)
719 ::Sentry . configure_scope do |scope |
820 scope . set_tags (
Original file line number Diff line number Diff line change 22
33module Sentry
44 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
513 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
617 def call
718 yield
819 rescue Exception => e
Original file line number Diff line number Diff line change 22
33module Sentry
44 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
516 VERSION = "1.0.0"
617 end
718end
You can’t perform that action at this time.
0 commit comments