Class: OpenTelemetry::SDK::Trace::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/sdk/trace/event.rb

Overview

A text annotation with a set of attributes and a timestamp.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, attributes: nil, timestamp: nil) ⇒ Event

Returns a new immutable OpenTelemetry::SDK::Trace::Event.

Parameters:

  • name (String)

    The name of this event

  • attributes (optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}) (defaults to: nil)

    A hash of attributes for this event. Attributes will be frozen during Event initialization.

  • timestamp (optional Time) (defaults to: nil)

    The timestamp for this event. Defaults to Time.now.



40
41
42
43
44
# File 'lib/opentelemetry/sdk/trace/event.rb', line 40

def initialize(name:, attributes: nil, timestamp: nil)
  @name = name
  @attributes = attributes.freeze || EMPTY_ATTRIBUTES
  @timestamp = timestamp || Time.now
end

Instance Attribute Details

#attributesHash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>} (readonly)

Returns the frozen attributes for this event

Returns:

  • (Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>})


24
25
26
# File 'lib/opentelemetry/sdk/trace/event.rb', line 24

def attributes
  @attributes
end

#nameString (readonly)

Returns the name of this event

Returns:

  • (String)


19
20
21
# File 'lib/opentelemetry/sdk/trace/event.rb', line 19

def name
  @name
end

#timestampTime (readonly)

Returns the timestamp for this event

Returns:

  • (Time)


29
30
31
# File 'lib/opentelemetry/sdk/trace/event.rb', line 29

def timestamp
  @timestamp
end