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
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#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.
73 74 75 76 77 78 79 |
# File 'lib/datadog/core/telemetry/metric.rb', line 73 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.
67 68 69 |
# File 'lib/datadog/core/telemetry/metric.rb', line 67 def interval @interval end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
87 88 89 |
# File 'lib/datadog/core/telemetry/metric.rb', line 87 def ==(other) super && interval == other.interval end |
#hash ⇒ Object
93 94 95 |
# File 'lib/datadog/core/telemetry/metric.rb', line 93 def hash [super, interval].hash end |
#to_h ⇒ Object
81 82 83 84 85 |
# File 'lib/datadog/core/telemetry/metric.rb', line 81 def to_h res = super res[:interval] = interval res end |