Class: Temporalio::Metric
- Inherits:
-
Object
- Object
- Temporalio::Metric
- Defined in:
- lib/temporalio/metric.rb
Overview
Metric that can be recorded from a metric meter. This is obtained via Meter#create_metric. The metric meter is obtained via workflow environment, activity context, or from the Runtime if in neither of those. This class is effectively abstract and will fail if ‘initialize` is attempted.
Direct Known Subclasses
Defined Under Namespace
Classes: Meter
Instance Method Summary collapse
-
#description ⇒ String?
Metric description.
-
#metric_type ⇒ :counter, ...
Metric type.
-
#name ⇒ String
Metric name.
-
#record(value, additional_attributes: nil) ⇒ Object
Record a value for the metric.
-
#unit ⇒ String?
Metric unit.
-
#value_type ⇒ :integer, ...
Metric value type.
-
#with_additional_attributes(additional_attributes) ⇒ Metric
Create a copy of this metric but with the given additional attributes.
Instance Method Details
#description ⇒ String?
Returns Metric description.
47 48 49 |
# File 'lib/temporalio/metric.rb', line 47 def description raise NotImplementedError end |
#metric_type ⇒ :counter, ...
Returns Metric type.
37 38 39 |
# File 'lib/temporalio/metric.rb', line 37 def metric_type raise NotImplementedError end |
#name ⇒ String
Returns Metric name.
42 43 44 |
# File 'lib/temporalio/metric.rb', line 42 def name raise NotImplementedError end |
#record(value, additional_attributes: nil) ⇒ Object
Record a value for the metric. For counters, this adds to any existing. For histograms, this records into proper buckets. For gauges, this sets the value. The value type must match the expectation.
22 23 24 |
# File 'lib/temporalio/metric.rb', line 22 def record(value, additional_attributes: nil) raise NotImplementedError end |
#unit ⇒ String?
Returns Metric unit.
52 53 54 |
# File 'lib/temporalio/metric.rb', line 52 def unit raise NotImplementedError end |
#value_type ⇒ :integer, ...
Returns Metric value type.
57 58 59 |
# File 'lib/temporalio/metric.rb', line 57 def value_type raise NotImplementedError end |
#with_additional_attributes(additional_attributes) ⇒ Metric
Create a copy of this metric but with the given additional attributes. This is more performant than providing attributes on each #record call.
32 33 34 |
# File 'lib/temporalio/metric.rb', line 32 def with_additional_attributes(additional_attributes) raise NotImplementedError end |