Class: Datadog::Core::Telemetry::Metric::IntervalMetric
- Defined in:
- lib/datadog/core/telemetry/metric.rb
Overview
Base class for metrics that require aggregation interval
Instance Attribute Summary collapse
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
Attributes inherited from Base
#common, #name, #tags, #values
Instance Method Summary collapse
-
#initialize(name, interval:, tags: {}, common: true) ⇒ IntervalMetric
constructor
A new instance of IntervalMetric.
- #to_h ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(name, interval:, tags: {}, common: true) ⇒ IntervalMetric
Returns a new instance of IntervalMetric.
61 62 63 64 65 66 67 |
# File 'lib/datadog/core/telemetry/metric.rb', line 61 def initialize(name, interval:, tags: {}, common: true) raise ArgumentError, 'interval must be a positive number' if interval.nil? || interval <= 0 super(name, tags: , common: common) @interval = interval end |
Instance Attribute Details
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
55 56 57 |
# File 'lib/datadog/core/telemetry/metric.rb', line 55 def interval @interval end |
Instance Method Details
#to_h ⇒ Object
69 70 71 72 73 |
# File 'lib/datadog/core/telemetry/metric.rb', line 69 def to_h res = super res[:interval] = interval res end |