Class: OpenCensus::Trace::MessageEvent

Inherits:
TimeEvent
  • Object
show all
Defined in:
lib/opencensus/trace/message_event.rb

Overview

An event describing a message sent/received between Spans.

Constant Summary collapse

TYPE_UNSPECIFIED =

Unknown event type.

:TYPE_UNSPECIFIED
SENT =

Indicates a sent message.

:SENT
RECEIVED =

Indicates a received message.

:RECEIVED

Instance Attribute Summary collapse

Attributes inherited from TimeEvent

#time

Instance Method Summary collapse

Constructor Details

#initialize(type, id, uncompressed_size, compressed_size: 0, time: nil) ⇒ MessageEvent

Create a new MessageEvent object.



70
71
72
73
74
75
76
77
# File 'lib/opencensus/trace/message_event.rb', line 70

def initialize type, id, uncompressed_size, compressed_size: 0,
               time: nil
  super time: time
  @type = type
  @id = id
  @uncompressed_size = uncompressed_size
  @compressed_size = compressed_size
end

Instance Attribute Details

#compressed_sizeInteger (readonly)

The number of compressed bytes sent or received. If zero, assumed to be the same size as uncompressed.

Returns:

  • (Integer)


63
64
65
# File 'lib/opencensus/trace/message_event.rb', line 63

def compressed_size
  @compressed_size
end

#idInteger (readonly)

An identifier for the MessageEvent’s message that can be used to match SENT and RECEIVED MessageEvents. For example, this field could represent a sequence ID for a streaming RPC. It is recommended to be unique within a Span.

Returns:

  • (Integer)


48
49
50
# File 'lib/opencensus/trace/message_event.rb', line 48

def id
  @id
end

#typeSymbol (readonly)

The type of MessageEvent. Indicates whether the message was sent or received. You should use the type constants provided by this class.

Returns:

  • (Symbol)


38
39
40
# File 'lib/opencensus/trace/message_event.rb', line 38

def type
  @type
end

#uncompressed_sizeInteger (readonly)

The number of uncompressed bytes sent or received.

Returns:

  • (Integer)


55
56
57
# File 'lib/opencensus/trace/message_event.rb', line 55

def uncompressed_size
  @uncompressed_size
end