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