Class: LogStash::Instrument::NamespacedNullMetric
- Inherits:
-
Object
- Object
- LogStash::Instrument::NamespacedNullMetric
- Defined in:
- lib/logstash/instrument/namespaced_null_metric.rb
Overview
This class acts a a proxy between the metric library and the user calls.
This is the class that plugins authors will use to interact with the ‘MetricStore` It has the same public interface as `Metric` class but doesnt require to send the namespace on every call.
Instance Attribute Summary collapse
-
#namespace_name ⇒ Object
readonly
Returns the value of attribute namespace_name.
Instance Method Summary collapse
- #collector ⇒ Object
- #decrement(key, value = 1) ⇒ Object
- #gauge(key, value) ⇒ Object
- #increment(key, value = 1) ⇒ Object
-
#initialize(metric = nil, namespace_name = :null) ⇒ NamespacedNullMetric
constructor
Create metric with a specific namespace.
- #namespace(name) ⇒ Object
- #report_time(key, duration) ⇒ Object
- #time(key, &block) ⇒ Object
Constructor Details
#initialize(metric = nil, namespace_name = :null) ⇒ NamespacedNullMetric
Create metric with a specific namespace
18 19 20 21 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 18 def initialize(metric = nil, namespace_name = :null) @metric = metric @namespace_name = Array(namespace_name) end |
Instance Attribute Details
#namespace_name ⇒ Object (readonly)
Returns the value of attribute namespace_name.
13 14 15 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 13 def namespace_name @namespace_name end |
Instance Method Details
#collector ⇒ Object
43 44 45 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 43 def collector @metric.collector end |
#decrement(key, value = 1) ⇒ Object
26 27 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 26 def decrement(key, value = 1) end |
#gauge(key, value) ⇒ Object
29 30 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 29 def gauge(key, value) end |
#increment(key, value = 1) ⇒ Object
23 24 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 23 def increment(key, value = 1) end |
#namespace(name) ⇒ Object
47 48 49 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 47 def namespace(name) NamespacedNullMetric.new(metric, namespace_name + Array(name)) end |
#report_time(key, duration) ⇒ Object
32 33 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 32 def report_time(key, duration) end |
#time(key, &block) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/logstash/instrument/namespaced_null_metric.rb', line 35 def time(key, &block) if block_given? yield else ::LogStash::Instrument::NullMetric::NullTimedExecution end end |