Class: OpenTelemetry::SDK::Metrics::Aggregation::LastValue

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/sdk/metrics/aggregation/last_value.rb

Overview

Contains the implementation of the LastValue aggregation

Instance Method Summary collapse

Instance Method Details

#collect(start_time, end_time, data_points) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/opentelemetry/sdk/metrics/aggregation/last_value.rb', line 13

def collect(start_time, end_time, data_points)
  ndps = data_points.values.map! do |ndp|
    ndp.start_time_unix_nano = start_time
    ndp.time_unix_nano = end_time
    ndp
  end
  data_points.clear
  ndps
end

#update(increment, attributes, data_points) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/opentelemetry/sdk/metrics/aggregation/last_value.rb', line 23

def update(increment, attributes, data_points)
  data_points[attributes] = NumberDataPoint.new(
    attributes,
    nil,
    nil,
    increment,
    nil
  )
  nil
end