Class: Evil::Metrics::Metric
- Inherits:
-
Object
- Object
- Evil::Metrics::Metric
- Extended by:
- Dry::Initializer
- Defined in:
- lib/evil/metrics/metric.rb
Overview
Base class for all metrics
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Documentation string.
-
#group ⇒ Object
readonly
Category name for grouping metrics.
-
#name ⇒ Object
readonly
Metric name.
-
#per ⇒ Object
readonly
Per which unit is measured ‘unit`.
-
#unit ⇒ Object
readonly
In which units it is measured.
Instance Method Summary collapse
-
#get(labels = {}) ⇒ Object
Returns the value for the given label set.
- #initialize(name, **options) ⇒ Object constructor
- #values ⇒ Object
Constructor Details
#initialize(name, **options) ⇒ Object
Instance Attribute Details
#comment ⇒ Object (readonly)
Documentation string. Required by some adapters.
Reader method for the comment
initializer parameter.
12 |
# File 'lib/evil/metrics/metric.rb', line 12 option :comment, optional: true, comment: "Documentation string. Required by some adapters." |
#group ⇒ Object (readonly)
Category name for grouping metrics
Reader method for the group
initializer parameter.
15 |
# File 'lib/evil/metrics/metric.rb', line 15 option :group, optional: true, comment: "Category name for grouping metrics" |
#name ⇒ Object (readonly)
Metric name. Use snake_case. E.g. job_runtime
Reader method for the name
initializer parameter.
11 |
# File 'lib/evil/metrics/metric.rb', line 11 param :name, comment: "Metric name. Use snake_case. E.g. job_runtime" |
#per ⇒ Object (readonly)
Per which unit is measured ‘unit`. E.g. `call` as in seconds per call
Reader method for the per
initializer parameter.
14 |
# File 'lib/evil/metrics/metric.rb', line 14 option :per, optional: true, comment: "Per which unit is measured `unit`. E.g. `call` as in seconds per call" |
#unit ⇒ Object (readonly)
In which units it is measured. E.g. ‘seconds`
Reader method for the unit
initializer parameter.
13 |
# File 'lib/evil/metrics/metric.rb', line 13 option :unit, optional: true, comment: "In which units it is measured. E.g. `seconds`" |
Instance Method Details
#get(labels = {}) ⇒ Object
Returns the value for the given label set
18 19 20 |
# File 'lib/evil/metrics/metric.rb', line 18 def get(labels = {}) values[labels] end |
#values ⇒ Object
22 23 24 |
# File 'lib/evil/metrics/metric.rb', line 22 def values @values ||= Concurrent::Hash.new end |