Class: Appsignal::Minutely::ProbeCollection
- Includes:
- Utils::DeprecationMessage
- Defined in:
- lib/appsignal/minutely.rb
Instance Method Summary collapse
-
#<<(probe) ⇒ void
deprecated
Deprecated.
Use #register instead.
-
#[](key) ⇒ Object
Fetch a probe using its name.
-
#clear ⇒ void
Clears all probes from the list.
-
#count ⇒ Integer
Number of probes that are registered.
- #each(&block) ⇒ Object private
-
#initialize ⇒ ProbeCollection
constructor
A new instance of ProbeCollection.
-
#register(name, probe) ⇒ void
Register a new minutely probe.
Methods included from Utils::DeprecationMessage
Constructor Details
#initialize ⇒ ProbeCollection
Returns a new instance of ProbeCollection.
8 9 10 |
# File 'lib/appsignal/minutely.rb', line 8 def initialize @probes = {} end |
Instance Method Details
#<<(probe) ⇒ void
Deprecated.
Use #register instead.
This method returns an undefined value.
34 35 36 37 38 39 |
# File 'lib/appsignal/minutely.rb', line 34 def <<(probe) "Deprecated `Appsignal::Minute.probes <<` " \ "call. Please use `Appsignal::Minutely.probes.register` instead.", logger register probe.object_id, probe end |
#[](key) ⇒ Object
Fetch a probe using its name.
26 27 28 |
# File 'lib/appsignal/minutely.rb', line 26 def [](key) probes[key] end |
#clear ⇒ void
This method returns an undefined value.
Clears all probes from the list.
19 20 21 |
# File 'lib/appsignal/minutely.rb', line 19 def clear probes.clear end |
#count ⇒ Integer
Returns Number of probes that are registered.
13 14 15 |
# File 'lib/appsignal/minutely.rb', line 13 def count probes.count end |
#each(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
115 116 117 |
# File 'lib/appsignal/minutely.rb', line 115 def each(&block) probes.each(&block) end |
#register(name, probe) ⇒ void
This method returns an undefined value.
Register a new minutely probe.
Supported probe types are:
- Lambda - A lambda is an object that listens to a
call
method call. Thiscall
method is called every minute. - Class - A class object is an object that listens to a
new
andcall
method call. Thenew
method is called when the Minutely probe thread is started to initialize all probes. This allows probes to load dependencies once beforehand. Theircall
method is called every minute. - Class instance - A class instance object is an object that listens to
a
call
method call. Thecall
method is called every minute.
106 107 108 109 110 111 112 |
# File 'lib/appsignal/minutely.rb', line 106 def register(name, probe) if probes.key?(name) logger.debug "A probe with the name `#{name}` is already " \ "registered. Overwriting the entry with the new probe." end probes[name] = probe end |