Class: SentrySmartSampler::SampleRatePerErrorRegistry::Registration
- Inherits:
-
Object
- Object
- SentrySmartSampler::SampleRatePerErrorRegistry::Registration
- Defined in:
- lib/sentry_smart_sampler/sample_rate_per_error_registry.rb
Instance Attribute Summary collapse
-
#samplable ⇒ Object
readonly
Returns the value of attribute samplable.
-
#sample_rate ⇒ Object
readonly
Returns the value of attribute sample_rate.
Instance Method Summary collapse
-
#initialize(samplable:, sample_rate:) ⇒ Registration
constructor
A new instance of Registration.
- #matches?(matchable_error) ⇒ Boolean
Constructor Details
#initialize(samplable:, sample_rate:) ⇒ Registration
Returns a new instance of Registration.
30 31 32 33 |
# File 'lib/sentry_smart_sampler/sample_rate_per_error_registry.rb', line 30 def initialize(samplable:, sample_rate:) @samplable = samplable @sample_rate = sample_rate end |
Instance Attribute Details
#samplable ⇒ Object (readonly)
Returns the value of attribute samplable.
28 29 30 |
# File 'lib/sentry_smart_sampler/sample_rate_per_error_registry.rb', line 28 def samplable @samplable end |
#sample_rate ⇒ Object (readonly)
Returns the value of attribute sample_rate.
28 29 30 |
# File 'lib/sentry_smart_sampler/sample_rate_per_error_registry.rb', line 28 def sample_rate @sample_rate end |
Instance Method Details
#matches?(matchable_error) ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/sentry_smart_sampler/sample_rate_per_error_registry.rb', line 35 def matches?(matchable_error) if samplable.is_a?(Regexp) || samplable.respond_to?(:to_str) matchable_error..scan(samplable).any? else matchable_error.is_a?(samplable) end end |