Class: OpenCensus::Stats::View

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

Overview

View

A View specifies an aggregation and a set of tag keys. The aggregation will be broken down by the unique set of matching tag values for each measure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, measure:, aggregation:, columns:, description: nil) ⇒ View

Create instance of the view

Parameters:

  • name (String)
  • measure (Measure)
  • aggregation (Aggregation)
  • columns (Array<String>)
  • description (String) (defaults to: nil)


42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/opencensus/stats/view.rb', line 42

def initialize \
    name:,
    measure:,
    aggregation:,
    columns:,
    description: nil
  @name = name
  @measure = measure
  @aggregation = aggregation
  @columns = columns
  @description = description
  @time = Time.now.utc
end

Instance Attribute Details

#aggregationAggregation (readonly)

Returns Associated aggregation definition instance.

Returns:

  • (Aggregation)

    Associated aggregation definition instance.



19
20
21
# File 'lib/opencensus/stats/view.rb', line 19

def aggregation
  @aggregation
end

#columnsArray<String> (readonly)

Columns (a.k.a Tag Keys) to match with the associated Measure. Measure will be recorded in a "greedy" way. That is, every view aggregates every measure. This is similar to doing a GROUPBY on view columns. Columns must be unique.

Returns:

  • (Array<String>)


27
28
29
# File 'lib/opencensus/stats/view.rb', line 27

def columns
  @columns
end

#descriptionString (readonly)

Returns Detailed description.

Returns:

  • (String)

    Detailed description



30
31
32
# File 'lib/opencensus/stats/view.rb', line 30

def description
  @description
end

#measureMeasure (readonly)

Returns Associated measure definition instance.

Returns:

  • (Measure)

    Associated measure definition instance.



16
17
18
# File 'lib/opencensus/stats/view.rb', line 16

def measure
  @measure
end

#nameString (readonly)

Returns Name of the view.

Returns:

  • (String)

    Name of the view



13
14
15
# File 'lib/opencensus/stats/view.rb', line 13

def name
  @name
end

#timeTime (readonly)

Returns View creation time.

Returns:

  • (Time)

    View creation time.



33
34
35
# File 'lib/opencensus/stats/view.rb', line 33

def time
  @time
end