Class: OpenCensus::Stats::AggregationData::Count

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

Overview

Count

Counts number of measurements recorded.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#timeTime (readonly)

Returns The latest timestamp a new data point was recorded.

Returns:

  • (Time)

    The latest timestamp a new data point was recorded



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

def time
  @time
end

#valueInteger, Float (readonly)

Returns Current count value.

Returns:

  • (Integer, Float)

    Current count value.



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

def value
  @value
end

Instance Method Details

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

Increment counter.

Parameters:

  • value (Value)
  • time (Time)

    Time of data point was recorded

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

    Attachments are not in use.



28
29
30
31
# File 'lib/opencensus/stats/aggregation_data/count.rb', line 28

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