Class: Yabeda::Group
- Inherits:
-
Object
- Object
- Yabeda::Group
- Extended by:
- Dry::Initializer
- Defined in:
- lib/yabeda/group.rb
Overview
Represents a set of metrics grouped under the same name
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Reader method for the
name
initializer parameter.
Instance Method Summary collapse
- #adapter(*adapter_names) ⇒ Object
- #default_tag(key, value) ⇒ Object
- #default_tags ⇒ Object
- #initialize(name) ⇒ Object constructor
- #register_metric(metric) ⇒ Object
Constructor Details
#initialize(name) ⇒ Object
Instance Attribute Details
#name ⇒ Object (readonly)
Reader method for the name
initializer parameter.
10 |
# File 'lib/yabeda/group.rb', line 10 param :name |
Instance Method Details
#adapter(*adapter_names) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/yabeda/group.rb', line 22 def adapter(*adapter_names) return @adapter if adapter_names.empty? @adapter ||= Concurrent::Array.new @adapter.push(*adapter_names) end |
#default_tag(key, value) ⇒ Object
17 18 19 20 |
# File 'lib/yabeda/group.rb', line 17 def default_tag(key, value) @default_tags ||= Concurrent::Hash.new @default_tags[key] = value end |
#default_tags ⇒ Object
12 13 14 15 |
# File 'lib/yabeda/group.rb', line 12 def @default_tags ||= Concurrent::Hash.new ::Yabeda..merge(@default_tags) end |
#register_metric(metric) ⇒ Object
29 30 31 |
# File 'lib/yabeda/group.rb', line 29 def register_metric(metric) define_singleton_method(metric.name) { metric } end |