Search in sources :

Example 6 with MessageEvent

use of io.opencensus.trace.MessageEvent in project instrumentation-java by census-instrumentation.

the class AbstractHttpHandlerTest method handleMessageReceived.

@Test
public void handleMessageReceived() {
    Type type = Type.RECEIVED;
    long uncompressed = 456L;
    HttpRequestContext context = new HttpRequestContext(fakeSpan, tagContext);
    handler.handleMessageReceived(context, uncompressed);
    verify(fakeSpan).addMessageEvent(captor.capture());
    MessageEvent messageEvent = captor.getValue();
    assertThat(messageEvent.getType()).isEqualTo(type);
    assertThat(messageEvent.getMessageId()).isEqualTo(1L);
    assertThat(messageEvent.getUncompressedMessageSize()).isEqualTo(uncompressed);
    assertThat(messageEvent.getCompressedMessageSize()).isEqualTo(0);
}
Also used : Type(io.opencensus.trace.MessageEvent.Type) MessageEvent(io.opencensus.trace.MessageEvent) Test(org.junit.Test)

Aggregations

MessageEvent (io.opencensus.trace.MessageEvent)6 Test (org.junit.Test)4 Metadata (io.grpc.Metadata)2 EndSpanOptions (io.opencensus.trace.EndSpanOptions)2 Type (io.opencensus.trace.MessageEvent.Type)2 InOrder (org.mockito.InOrder)2 ClientStreamTracer (io.grpc.ClientStreamTracer)1 Context (io.grpc.Context)1 ServerStreamTracer (io.grpc.ServerStreamTracer)1 CallAttemptsTracerFactory (io.grpc.census.CensusTracingModule.CallAttemptsTracerFactory)1 Log (io.jaegertracing.thriftjava.Log)1 Tag (io.jaegertracing.thriftjava.Tag)1 TagContext (io.opencensus.tags.TagContext)1 Annotation (io.opencensus.trace.Annotation)1 SpanContext (io.opencensus.trace.SpanContext)1 SpanData (io.opencensus.trace.export.SpanData)1