Class: Mayu::Metrics::Collector::DataStore::MetricStore
- Inherits:
-
Object
- Object
- Mayu::Metrics::Collector::DataStore::MetricStore
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/metrics/collector.rb
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
- #all_values ⇒ Object
-
#initialize(store, metric_name, metric_type:, metric_settings: {}) ⇒ MetricStore
constructor
A new instance of MetricStore.
- #set(val:, labels: {}) ⇒ Object
Constructor Details
#initialize(store, metric_name, metric_type:, metric_settings: {}) ⇒ MetricStore
Returns a new instance of MetricStore.
21 22 23 24 25 26 27 28 |
# File 'lib/mayu/metrics/collector.rb', line 21 def initialize(store, metric_name, metric_type:, metric_settings: {}) @store = store @metric_name = metric_name @metric_type = metric_type @metric_settings = metric_settings @aggregation_mode = T.let(metric_settings.fetch(:aggregation, :sum), Symbol) end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
11 12 13 |
# File 'lib/mayu/metrics/collector.rb', line 11 def store @store end |
Instance Method Details
#all_values ⇒ Object
40 41 42 43 44 |
# File 'lib/mayu/metrics/collector.rb', line 40 def all_values @store .values_for_metric(@metric_name) .transform_values { aggregate(_1) } end |
#set(val:, labels: {}) ⇒ Object
36 37 |
# File 'lib/mayu/metrics/collector.rb', line 36 def set(val:, labels: {}) end |