Class: Yabeda::ActionCable::Config
- Inherits:
-
Object
- Object
- Yabeda::ActionCable::Config
- Defined in:
- lib/yabeda/action_cable/config.rb
Constant Summary collapse
- DEFAULT_BUCKETS =
[ 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10 ].freeze
- DEFAULT_STREAM_NAME =
"yabeda.action_cable.metrics"- DEFAULT_COLLECTION_PERIOD =
60.seconds.freeze
- DEFAULT_CHANNEL_CLASS_NAME =
"ApplicationCable::Channel"
Instance Attribute Summary collapse
-
#buckets ⇒ Object
Returns the value of attribute buckets.
-
#channel_class_name ⇒ Object
Returns the value of attribute channel_class_name.
- #collection_cooldown_period ⇒ Object
-
#collection_period ⇒ Object
Returns the value of attribute collection_period.
-
#default_buckets ⇒ Object
Returns the value of attribute default_buckets.
-
#default_tags ⇒ Object
Returns the value of attribute default_tags.
-
#stream_name ⇒ Object
Returns the value of attribute stream_name.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
- #buckets_for(metric) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #reset! ⇒ Object
- #tags_for(metric) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
23 24 25 |
# File 'lib/yabeda/action_cable/config.rb', line 23 def initialize reset! end |
Instance Attribute Details
#buckets ⇒ Object
Returns the value of attribute buckets.
14 15 16 |
# File 'lib/yabeda/action_cable/config.rb', line 14 def buckets @buckets end |
#channel_class_name ⇒ Object
Returns the value of attribute channel_class_name.
14 15 16 |
# File 'lib/yabeda/action_cable/config.rb', line 14 def channel_class_name @channel_class_name end |
#collection_cooldown_period ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/yabeda/action_cable/config.rb', line 38 def collection_cooldown_period if @collection_cooldown_period.nil? collection_period / 2.0 else @collection_cooldown_period end end |
#collection_period ⇒ Object
Returns the value of attribute collection_period.
14 15 16 |
# File 'lib/yabeda/action_cable/config.rb', line 14 def collection_period @collection_period end |
#default_buckets ⇒ Object
Returns the value of attribute default_buckets.
14 15 16 |
# File 'lib/yabeda/action_cable/config.rb', line 14 def default_buckets @default_buckets end |
#default_tags ⇒ Object
Returns the value of attribute default_tags.
14 15 16 |
# File 'lib/yabeda/action_cable/config.rb', line 14 def @default_tags end |
#stream_name ⇒ Object
Returns the value of attribute stream_name.
14 15 16 |
# File 'lib/yabeda/action_cable/config.rb', line 14 def stream_name @stream_name end |
#tags ⇒ Object
Returns the value of attribute tags.
14 15 16 |
# File 'lib/yabeda/action_cable/config.rb', line 14 def @tags end |
Instance Method Details
#buckets_for(metric) ⇒ Object
46 47 48 |
# File 'lib/yabeda/action_cable/config.rb', line 46 def buckets_for(metric) buckets[metric] || default_buckets end |
#reset! ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/yabeda/action_cable/config.rb', line 27 def reset! @default_buckets = DEFAULT_BUCKETS.dup @buckets = {} @default_tags = {} @tags = {} @stream_name = DEFAULT_STREAM_NAME @collection_period = DEFAULT_COLLECTION_PERIOD.dup @collection_cooldown_period = nil @channel_class_name = DEFAULT_CHANNEL_CLASS_NAME end |
#tags_for(metric) ⇒ Object
50 51 52 |
# File 'lib/yabeda/action_cable/config.rb', line 50 def (metric) [metric] || end |