Class: OpenTelemetry::Trace::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/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::Trace::Event.

Parameters:

  • name (String)

    The name of this event

  • attributes (optional Hash<String, Object>) (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.



38
39
40
41
42
# File 'lib/opentelemetry/trace/event.rb', line 38

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

Instance Attribute Details

#attributesHash<String, Object> (readonly)

Returns the frozen attributes for this event

Returns:

  • (Hash<String, Object>)


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

def attributes
  @attributes
end

#nameString (readonly)

Returns the name of this event

Returns:

  • (String)


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

def name
  @name
end

#timestampTime (readonly)

Returns the timestamp for this event

Returns:

  • (Time)


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

def timestamp
  @timestamp
end