Class: Honeybadger::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/honeybadger/registry.rb

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



3
4
5
6
# File 'lib/honeybadger/registry.rb', line 3

def initialize
  @mutex = Mutex.new
  @metrics = Hash.new
end

Instance Method Details

#flushObject



20
21
22
23
24
# File 'lib/honeybadger/registry.rb', line 20

def flush
  @mutex.synchronize do
    @metrics = Hash.new
  end
end

#get(metric_type, name, attributes) ⇒ Object



14
15
16
17
18
# File 'lib/honeybadger/registry.rb', line 14

def get(metric_type, name, attributes)
  @mutex.synchronize do
    @metrics[Honeybadger::Metric.signature(metric_type, name, attributes)]
  end
end

#metricsObject



26
27
28
29
30
# File 'lib/honeybadger/registry.rb', line 26

def metrics
  @mutex.synchronize do
    @metrics.values
  end
end

#register(metric) ⇒ Object



8
9
10
11
12
# File 'lib/honeybadger/registry.rb', line 8

def register(metric)
  @mutex.synchronize do
    @metrics[metric.signature] = metric
  end
end