Message event

Type

Type enumerates the various states of a message event. It can be either of these:

Type

Value

Description

SENT

1

Indicates that this message was sent

RECEIVED

2

Indicates that this message was sent

UNKNOWN

0

Unknown event type or default value

ID

The identifier for the message to help correlate between SENT and RECEIVED message events.
For example it can be useful when matching sequence/state numbers between protocol handshakes
or for a streaming RPC. It is recommended to be unique within a span.

Uncompressed size

The number of uncompressed bytes sent or received.

Compressed size

The number of compressed bytes sent or received. If this value is zero, it is assumed to be the same as Uncompressed size

Source code samples

// On the client
span.AddMessageReceiveEvent(seqNumber,1024,512)// On the server
span.AddMessageSendEvent(seqNumber,1024,512)

importio.opencensus.trace.MessageEvent;importio.opencensus.trace.MessageEvent.Type;// On the client
MessageEventclientEvent=MessageEvent.builder(Type.RECEIVED,seqNumber).setCompressedMessageSize(512).setUncompressedMessageSize(1024).build();clientSpan.addMessageEvent(clientEvent);// On the server
MessageEventserverEvent=MessageEvent.builder(Type.SENT,seqNumber).setCompressedMessageSize(512).setUncompressedMessageSize(1024).build();serverSpan.addMessageEvent(serverEvent);

// On the client
span.AddReceivedMessageEvent(seqNumber,512,1024);// On the server
span.AddSentMessageEvent(seqNumber,512,1024);

importdatetimeclientEvent=time_event.MessageEvent(seqNumber,type=time_event.Type.RECEIVED,uncompressed_size_bytes=1024,compressed_size_bytes=512)span.add_time_event(time_event.TimeEvent(datetime.datetime.utcnow(),clientEvent))# On the server$serverEvent=time_event.MessageEvent(seqNumber,type=time_event.Type.SENT,uncompressed_size_bytes=1024,compressed_size_bytes=512)span.add_time_event(time_event.TimeEvent(datetime.datetime.utcnow(),serverEvent))