Class: Honeybadger::Registry
- Inherits:
-
Object
- Object
- Honeybadger::Registry
- Defined in:
- lib/honeybadger/registry.rb
Instance Method Summary collapse
- #flush ⇒ Object
- #get(metric_type, name, attributes) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #metrics ⇒ Object
- #register(metric) ⇒ Object
Constructor Details
#initialize ⇒ Registry
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
#flush ⇒ Object
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 |
#metrics ⇒ Object
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 |