Module: Gruf::Sentry::Configuration
- Included in:
- Gruf::Sentry
- Defined in:
- lib/gruf/sentry/configuration.rb
Overview
Configuration module for gruf-sentry
Constant Summary collapse
- VALID_CONFIG_KEYS =
{ grpc_error_classes: ::ENV.fetch( 'GRUF_SENTRY_GRPC_ERROR_CLASSES', 'GRPC::Unknown,GRPC::Internal,GRPC::DataLoss,GRPC::FailedPrecondition,GRPC::Unavailable,GRPC::DeadlineExceeded,GRPC::Cancelled' ).to_s.split(',').map(&:strip), default_error_code: ::ENV.fetch('GRUF_SENTRY_DEFAULT_ERROR_CODE', GRPC::Core::StatusCodes::INTERNAL).to_i, ignore_methods: ::ENV.fetch('GRUF_SENTRY_IGNORE_METHODS', '').split(',').map(&:strip) || [] }.freeze
Class Method Summary collapse
-
.extended(base) ⇒ Object
Whenever this is extended into a class, setup the defaults.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Gruf::Sentry::Configuration
Yield self for ruby-style initialization.
-
#options ⇒ Hash
Return the current configuration options as a Hash.
-
#reset ⇒ Hash
Set the default configuration onto the extended class.
Class Method Details
.extended(base) ⇒ Object
Whenever this is extended into a class, setup the defaults
38 39 40 |
# File 'lib/gruf/sentry/configuration.rb', line 38 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Gruf::Sentry::Configuration
Yield self for ruby-style initialization
48 49 50 |
# File 'lib/gruf/sentry/configuration.rb', line 48 def configure yield self end |
#options ⇒ Hash
Return the current configuration options as a Hash
57 58 59 60 61 62 63 |
# File 'lib/gruf/sentry/configuration.rb', line 57 def opts = {} VALID_CONFIG_KEYS.each_key do |k| opts.merge!(k => send(k)) end opts end |
#reset ⇒ Hash
Set the default configuration onto the extended class
70 71 72 73 74 75 76 |
# File 'lib/gruf/sentry/configuration.rb', line 70 def reset VALID_CONFIG_KEYS.each do |k, v| send("#{k}=".to_sym, v) end end |