Class: Yabeda::Group

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/yabeda/group.rb

Overview

Represents a set of metrics grouped under the same name

Direct Known Subclasses

GlobalGroup

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Object

Parameters:

  • name

Instance Attribute Details

#nameObject (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_tagsObject



12
13
14
15
# File 'lib/yabeda/group.rb', line 12

def default_tags
  @default_tags ||= Concurrent::Hash.new
  ::Yabeda.default_tags.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