Class: OpenCensus::Stats::AggregationData::LastValue

Inherits:
Object
  • Object
show all
Defined in:
lib/opencensus/stats/aggregation_data/last_value.rb

Overview

LastValue

Represents the last recorded value.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#timeTime (readonly)

Returns The latest time at new data point was recorded.

Returns:

  • (Time)

    The latest time at new data point was recorded



15
16
17
# File 'lib/opencensus/stats/aggregation_data/last_value.rb', line 15

def time
  @time
end

#valueInteger, Float (readonly)

Returns Last recorded value.

Returns:

  • (Integer, Float)

    Last recorded value.



12
13
14
# File 'lib/opencensus/stats/aggregation_data/last_value.rb', line 12

def value
  @value
end

Instance Method Details

#add(value, time, attachments: nil) ⇒ Object

Set last value

Parameters:

  • value (Integer, Float)
  • time (Time)

    Time of data point was recorded

  • attachments (Hash<String,String>) (defaults to: nil)

    Attachments are not in use



23
24
25
26
# File 'lib/opencensus/stats/aggregation_data/last_value.rb', line 23

def add value, time, attachments: nil
  @time = time
  @value = value
end