use of io.grpc.StreamTracer in project grpc-java by grpc.
the class NettyServerHandlerTest method streamTracerCreated.
@Test
public void streamTracerCreated() throws Exception {
manualSetUp();
createStream();
verify(streamTracerFactory).newServerStreamTracer(eq("foo/bar"), any(Metadata.class));
StatsTraceContext statsTraceCtx = stream.statsTraceContext();
List<StreamTracer> tracers = statsTraceCtx.getTracersForTest();
assertEquals(1, tracers.size());
assertSame(streamTracer, tracers.get(0));
}
use of io.grpc.StreamTracer in project grpc-java by grpc.
the class StatsTraceContext method serverFilterContext.
/**
* See {@link ServerStreamTracer#filterContext}. For server-side only.
*
* <p>Called from {@link io.grpc.internal.ServerImpl}.
*/
public <ReqT, RespT> Context serverFilterContext(Context context) {
Context ctx = checkNotNull(context, "context");
for (StreamTracer tracer : tracers) {
ctx = ((ServerStreamTracer) tracer).filterContext(ctx);
checkNotNull(ctx, "%s returns null context", tracer);
}
return ctx;
}
Aggregations