Class: OpenCensus::Stats::Measure

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

Overview

Measure

The definition of the Measurement. Describes the type of the individual values/measurements recorded by an application. It includes information such as the type of measurement, the units of measurement and descriptive names for the data. This provides th fundamental type used for recording data.

Constant Summary collapse

UNIT_NONE =

Describes the unit used for the Measure. Should follows the format described by http://unitsofmeasure.org/ucum.html Unit name for general counts

Returns:

  • (String)
"1".freeze
BYTE =

Unit name for bytes

Returns:

  • (String)
"By".freeze
KBYTE =

Unit name for Kilobytes

Returns:

  • (String)
"kb".freeze
SEC =

Unit name for Seconds

Returns:

  • (String)
"s".freeze
MS =

Unit name for Milli seconds

Returns:

  • (String)
"ms".freeze
US =

Unit name for Micro seconds

Returns:

  • (String)
"us".freeze
NS =

Unit name for Nano seconds

Returns:

  • (String)
"ns".freeze
INT64_TYPE =

Measure int64 type

Returns:

  • (String)
"INT64".freeze
DOUBLE_TYPE =

Measure double type

Returns:

  • (String)
"DOUBLE".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionString (readonly)

Returns:

  • (String)


59
60
61
# File 'lib/opencensus/stats/measure.rb', line 59

def description
  @description
end

#nameString (readonly)

Returns:

  • (String)


56
57
58
# File 'lib/opencensus/stats/measure.rb', line 56

def name
  @name
end

#typeString (readonly)

Data type of the measure.

Returns:



67
68
69
# File 'lib/opencensus/stats/measure.rb', line 67

def type
  @type
end

#unitString (readonly)

Unit type of the measurement. i.e "kb", "ms" etc

Returns:

  • (String)


63
64
65
# File 'lib/opencensus/stats/measure.rb', line 63

def unit
  @unit
end

Instance Method Details

#create_measurement(value:, tags:) ⇒ Measurement

Create new measurement

Parameters:

  • value (Integer, Float)
  • tags (Hash<String,String>)

    Tags to which the value is recorded

Returns:



82
83
84
# File 'lib/opencensus/stats/measure.rb', line 82

def create_measurement value:, tags:
  Measurement.new measure: self, value: value, tags: tags
end

#double?Boolean

Is float data type

Returns:

  • (Boolean)


94
95
96
# File 'lib/opencensus/stats/measure.rb', line 94

def double?
  type == DOUBLE_TYPE
end

#int64?Boolean

Is int64 data type

Returns:

  • (Boolean)


88
89
90
# File 'lib/opencensus/stats/measure.rb', line 88

def int64?
  type == INT64_TYPE
end