Class: Nightwing::Metric
- Inherits:
-
Object
- Object
- Nightwing::Metric
- Defined in:
- lib/nightwing/metric.rb
Instance Attribute Summary collapse
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
-
#for(queue:, worker: nil) ⇒ Object
Generates a metric name.
-
#initialize(namespace) ⇒ Metric
constructor
A new instance of Metric.
Constructor Details
#initialize(namespace) ⇒ Metric
Returns a new instance of Metric.
7 8 9 |
# File 'lib/nightwing/metric.rb', line 7 def initialize(namespace) @namespace = namespace end |
Instance Attribute Details
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
5 6 7 |
# File 'lib/nightwing/metric.rb', line 5 def namespace @namespace end |
Instance Method Details
#for(queue:, worker: nil) ⇒ Object
Generates a metric name
returns a String object
18 19 20 21 |
# File 'lib/nightwing/metric.rb', line 18 def for(queue:, worker: nil) worker_name = worker.to_s.underscore.tr("/", "_") if worker [namespace, queue, worker_name].compact.join(".") end |