Class: OpenCensus::Stats::Exemplar

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

Overview

Exemplars are example points that may be used to annotate aggregated Distribution values. They are metadata that gives information about a particular value added to a Distribution bucket.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, time:, attachments:) ⇒ Exemplar

Create instance of the exemplar

Parameters:

  • value (Integer, Float)
  • time (Time)
  • attachments. (Hash<String,String>)

    Attachments are key-value pairs that describe the context in which the exemplar was recored.

Raises:

  • (ArgumentError)


30
31
32
33
34
35
36
37
# File 'lib/opencensus/stats/exemplar.rb', line 30

def initialize value:, time:, attachments:
  @value = value
  @time = time

  raise ArgumentError, "attachments can not be empty" if attachments.nil?

  @attachments = attachments
end

Instance Attribute Details

#attachmentsHash<String,String> (readonly)

Contextual information about the example value

Returns:

  • (Hash<String,String>)


23
24
25
# File 'lib/opencensus/stats/exemplar.rb', line 23

def attachments
  @attachments
end

#timeTime (readonly)

The observation (sampling) time of the above value

Returns:

  • (Time)


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

def time
  @time
end

#valueInteger, Float (readonly)

Value of the exemplar point. It determines which bucket the exemplar belongs to

Returns:

  • (Integer, Float)


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

def value
  @value
end