Class: OpenCensus::Stats::ViewData
- Inherits:
-
Object
- Object
- OpenCensus::Stats::ViewData
- Defined in:
- lib/opencensus/stats/view_data.rb
Overview
ViewData is a container to store stats.
Instance Attribute Summary collapse
-
#data ⇒ Hash<Array<String>>, AggregationData
readonly
against view columns.
- #end_time ⇒ Time? readonly
- #start_time ⇒ Time? readonly
- #view ⇒ View readonly
Instance Method Summary collapse
-
#clear ⇒ Object
Clear recorded ata.
-
#record(measurement, attachments: nil) ⇒ Object
Record a measurement.
-
#start ⇒ Object
Set start time.
-
#stop ⇒ Object
Set stop time.
Instance Attribute Details
#data ⇒ Hash<Array<String>>, AggregationData (readonly)
against view columns.
19 20 21 |
# File 'lib/opencensus/stats/view_data.rb', line 19 def data @data end |
#end_time ⇒ Time? (readonly)
15 16 17 |
# File 'lib/opencensus/stats/view_data.rb', line 15 def end_time @end_time end |
#start_time ⇒ Time? (readonly)
12 13 14 |
# File 'lib/opencensus/stats/view_data.rb', line 12 def start_time @start_time end |
#view ⇒ View (readonly)
9 10 11 |
# File 'lib/opencensus/stats/view_data.rb', line 9 def view @view end |
Instance Method Details
#clear ⇒ Object
Clear recorded ata
63 64 65 |
# File 'lib/opencensus/stats/view_data.rb', line 63 def clear data.clear end |
#record(measurement, attachments: nil) ⇒ Object
Record a measurement.
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/opencensus/stats/view_data.rb', line 48 def record measurement, attachments: nil tag_values = @view.columns.map { |column| measurement.[column] } unless @data.key? tag_values @data[tag_values] = @view.aggregation.create_aggregation_data end @data[tag_values].add( measurement.value, measurement.time, attachments: ) end |
#start ⇒ Object
Set start time.
35 36 37 |
# File 'lib/opencensus/stats/view_data.rb', line 35 def start @start_time = Time.now.utc end |
#stop ⇒ Object
Set stop time.
40 41 42 |
# File 'lib/opencensus/stats/view_data.rb', line 40 def stop @end_time = Time.now.utc end |