本文整理匯總了Java中io.grpc.ServerStreamTracer.Factory方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerStreamTracer.Factory方法的具體用法?Java ServerStreamTracer.Factory怎麽用?Java ServerStreamTracer.Factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.grpc.ServerStreamTracer
的用法示例。
在下文中一共展示了ServerStreamTracer.Factory方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTracerFactories
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@VisibleForTesting
final List<ServerStreamTracer.Factory> getTracerFactories() {
ArrayList<ServerStreamTracer.Factory> tracerFactories =
new ArrayList<ServerStreamTracer.Factory>();
if (statsEnabled) {
CensusStatsModule censusStats = this.censusStatsOverride;
if (censusStats == null) {
censusStats = new CensusStatsModule(GrpcUtil.STOPWATCH_SUPPLIER, true);
}
tracerFactories.add(
censusStats.getServerTracerFactory(recordStartedRpcs, recordFinishedRpcs));
}
if (tracingEnabled) {
CensusTracingModule censusTracing =
new CensusTracingModule(Tracing.getTracer(),
Tracing.getPropagationComponent().getBinaryFormat());
tracerFactories.add(censusTracing.getServerTracerFactory());
}
tracerFactories.addAll(streamTracerFactories);
return tracerFactories;
}
示例2: buildTransportServer
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Override
@CheckReturnValue
protected NettyServer buildTransportServer(
List<ServerStreamTracer.Factory> streamTracerFactories) {
ProtocolNegotiator negotiator = protocolNegotiator;
if (negotiator == null) {
negotiator = sslContext != null ? ProtocolNegotiators.serverTls(sslContext) :
ProtocolNegotiators.serverPlaintext();
}
return new NettyServer(
address, channelType, channelOptions, bossEventLoopGroup, workerEventLoopGroup,
negotiator, streamTracerFactories, transportTracerFactory,
maxConcurrentCallsPerConnection, flowControlWindow,
maxMessageSize, maxHeaderListSize, keepAliveTimeInNanos, keepAliveTimeoutInNanos,
maxConnectionIdleInNanos,
maxConnectionAgeInNanos, maxConnectionAgeGraceInNanos,
permitKeepAliveWithoutCalls, permitKeepAliveTimeInNanos);
}
示例3: serverTracingSampledToLocalSpanStore
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Test
public void serverTracingSampledToLocalSpanStore() {
ServerStreamTracer.Factory tracerFactory = censusTracing.getServerTracerFactory();
ServerStreamTracer serverStreamTracer =
tracerFactory.newServerStreamTracer(sampledMethod.getFullMethodName(), new Metadata());
serverStreamTracer.filterContext(Context.ROOT);
serverStreamTracer.serverCallStarted(
new ServerCallInfoImpl<String, String>(sampledMethod, Attributes.EMPTY, null));
serverStreamTracer.streamClosed(Status.CANCELLED);
verify(spyServerSpan).end(
EndSpanOptions.builder()
.setStatus(io.opencensus.trace.Status.CANCELLED)
.setSampleToLocalSpanStore(true)
.build());
}
示例4: newServer
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Override
protected InternalServer newServer(
InternalServer server, List<ServerStreamTracer.Factory> streamTracerFactories) {
int port = server.getPort();
return AccessProtectedHack.serverBuilderBuildTransportServer(
NettyServerBuilder
.forPort(port)
.flowControlWindow(65 * 1024),
streamTracerFactories,
fakeClockTransportTracer);
}
示例5: NettyServerTransport
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
NettyServerTransport(
Channel channel,
ChannelPromise channelUnused,
ProtocolNegotiator protocolNegotiator,
List<ServerStreamTracer.Factory> streamTracerFactories,
TransportTracer transportTracer,
int maxStreams,
int flowControlWindow,
int maxMessageSize,
int maxHeaderListSize,
long keepAliveTimeInNanos,
long keepAliveTimeoutInNanos,
long maxConnectionIdleInNanos,
long maxConnectionAgeInNanos,
long maxConnectionAgeGraceInNanos,
boolean permitKeepAliveWithoutCalls,
long permitKeepAliveTimeInNanos) {
this.channel = Preconditions.checkNotNull(channel, "channel");
this.channelUnused = channelUnused;
this.protocolNegotiator = Preconditions.checkNotNull(protocolNegotiator, "protocolNegotiator");
this.streamTracerFactories =
Preconditions.checkNotNull(streamTracerFactories, "streamTracerFactories");
this.transportTracer = Preconditions.checkNotNull(transportTracer, "transportTracer");
this.maxStreams = maxStreams;
this.flowControlWindow = flowControlWindow;
this.maxMessageSize = maxMessageSize;
this.maxHeaderListSize = maxHeaderListSize;
this.keepAliveTimeInNanos = keepAliveTimeInNanos;
this.keepAliveTimeoutInNanos = keepAliveTimeoutInNanos;
this.maxConnectionIdleInNanos = maxConnectionIdleInNanos;
this.maxConnectionAgeInNanos = maxConnectionAgeInNanos;
this.maxConnectionAgeGraceInNanos = maxConnectionAgeGraceInNanos;
this.permitKeepAliveWithoutCalls = permitKeepAliveWithoutCalls;
this.permitKeepAliveTimeInNanos = permitKeepAliveTimeInNanos;
}
示例6: getTracerFactories_default
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Test
public void getTracerFactories_default() {
builder.addStreamTracerFactory(DUMMY_USER_TRACER);
List<ServerStreamTracer.Factory> factories = builder.getTracerFactories();
assertEquals(3, factories.size());
assertThat(factories.get(0)).isInstanceOf(CensusStatsModule.ServerTracerFactory.class);
assertThat(factories.get(1)).isInstanceOf(CensusTracingModule.ServerTracerFactory.class);
assertThat(factories.get(2)).isSameAs(DUMMY_USER_TRACER);
}
示例7: getTracerFactories_disableTracing
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Test
public void getTracerFactories_disableTracing() {
builder.addStreamTracerFactory(DUMMY_USER_TRACER);
builder.setTracingEnabled(false);
List<ServerStreamTracer.Factory> factories = builder.getTracerFactories();
assertEquals(2, factories.size());
assertThat(factories.get(0)).isInstanceOf(CensusStatsModule.ServerTracerFactory.class);
assertThat(factories.get(1)).isSameAs(DUMMY_USER_TRACER);
}
示例8: newServer
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Override
protected InternalServer newServer(
InternalServer server, List<ServerStreamTracer.Factory> streamTracerFactories) {
int port = server.getPort();
return NettyServerBuilder
.forPort(port)
.flowControlWindow(65 * 1024)
.setTransportTracerFactory(fakeClockTransportTracer)
.buildTransportServer(streamTracerFactories);
}
示例9: getTracerFactories_disableStats
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Test
public void getTracerFactories_disableStats() {
builder.addStreamTracerFactory(DUMMY_USER_TRACER);
builder.setStatsEnabled(false);
List<ServerStreamTracer.Factory> factories = builder.getTracerFactories();
assertEquals(2, factories.size());
assertThat(factories.get(0)).isInstanceOf(CensusTracingModule.ServerTracerFactory.class);
assertThat(factories.get(1)).isSameAs(DUMMY_USER_TRACER);
}
示例10: InProcessServer
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@VisibleForTesting
InProcessServer(
String name, ObjectPool<ScheduledExecutorService> schedulerPool,
List<ServerStreamTracer.Factory> streamTracerFactories) {
this.name = name;
this.schedulerPool = schedulerPool;
this.streamTracerFactories =
Collections.unmodifiableList(checkNotNull(streamTracerFactories, "streamTracerFactories"));
}
示例11: getTracerFactories_disableBoth
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Test
public void getTracerFactories_disableBoth() {
builder.addStreamTracerFactory(DUMMY_USER_TRACER);
builder.setTracingEnabled(false);
builder.setStatsEnabled(false);
List<ServerStreamTracer.Factory> factories = builder.getTracerFactories();
assertThat(factories).containsExactly(DUMMY_USER_TRACER);
}
示例12: serverTracingNotSampledToLocalSpanStore_whenServerCallNotCreated
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Test
public void serverTracingNotSampledToLocalSpanStore_whenServerCallNotCreated() {
ServerStreamTracer.Factory tracerFactory = censusTracing.getServerTracerFactory();
ServerStreamTracer serverStreamTracer =
tracerFactory.newServerStreamTracer(sampledMethod.getFullMethodName(), new Metadata());
serverStreamTracer.streamClosed(Status.CANCELLED);
verify(spyServerSpan).end(
EndSpanOptions.builder()
.setStatus(io.opencensus.trace.Status.CANCELLED)
.setSampleToLocalSpanStore(false)
.build());
}
示例13: newHandler
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
static NettyServerHandler newHandler(
ServerTransportListener transportListener,
ChannelPromise channelUnused,
List<ServerStreamTracer.Factory> streamTracerFactories,
TransportTracer transportTracer,
int maxStreams,
int flowControlWindow,
int maxHeaderListSize,
int maxMessageSize,
long keepAliveTimeInNanos,
long keepAliveTimeoutInNanos,
long maxConnectionIdleInNanos,
long maxConnectionAgeInNanos,
long maxConnectionAgeGraceInNanos,
boolean permitKeepAliveWithoutCalls,
long permitKeepAliveTimeInNanos) {
Preconditions.checkArgument(maxHeaderListSize > 0, "maxHeaderListSize must be positive");
Http2FrameLogger frameLogger = new Http2FrameLogger(LogLevel.DEBUG, NettyServerHandler.class);
Http2HeadersDecoder headersDecoder = new GrpcHttp2ServerHeadersDecoder(maxHeaderListSize);
Http2FrameReader frameReader = new Http2InboundFrameLogger(
new DefaultHttp2FrameReader(headersDecoder), frameLogger);
Http2FrameWriter frameWriter =
new Http2OutboundFrameLogger(new DefaultHttp2FrameWriter(), frameLogger);
return newHandler(
channelUnused,
frameReader,
frameWriter,
transportListener,
streamTracerFactories,
transportTracer,
maxStreams,
flowControlWindow,
maxHeaderListSize,
maxMessageSize,
keepAliveTimeInNanos,
keepAliveTimeoutInNanos,
maxConnectionIdleInNanos,
maxConnectionAgeInNanos,
maxConnectionAgeGraceInNanos,
permitKeepAliveWithoutCalls,
permitKeepAliveTimeInNanos);
}
示例14: serverBasicTracingNoHeaders
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
@Test
public void serverBasicTracingNoHeaders() {
ServerStreamTracer.Factory tracerFactory = censusTracing.getServerTracerFactory();
ServerStreamTracer serverStreamTracer =
tracerFactory.newServerStreamTracer(method.getFullMethodName(), new Metadata());
verifyZeroInteractions(mockTracingPropagationHandler);
verify(tracer).spanBuilderWithRemoteParent(
eq("Recv.package1.service2.method3"), isNull(SpanContext.class));
verify(spyServerSpanBuilder).setRecordEvents(eq(true));
Context filteredContext = serverStreamTracer.filterContext(Context.ROOT);
assertSame(spyServerSpan, ContextUtils.CONTEXT_SPAN_KEY.get(filteredContext));
serverStreamTracer.serverCallStarted(
new ServerCallInfoImpl<String, String>(method, Attributes.EMPTY, null));
verify(spyServerSpan, never()).end(any(EndSpanOptions.class));
serverStreamTracer.outboundMessage(0);
serverStreamTracer.outboundMessageSent(0, 882, -1);
serverStreamTracer.inboundMessage(0);
serverStreamTracer.outboundMessage(1);
serverStreamTracer.outboundMessageSent(1, -1, 27);
serverStreamTracer.inboundMessageRead(0, 255, 90);
serverStreamTracer.streamClosed(Status.CANCELLED);
InOrder inOrder = inOrder(spyServerSpan);
inOrder.verify(spyServerSpan, times(3)).addNetworkEvent(networkEventCaptor.capture());
List<NetworkEvent> events = networkEventCaptor.getAllValues();
assertEquals(
NetworkEvent.builder(Type.SENT, 0).setCompressedMessageSize(882).build(), events.get(0));
assertEquals(
NetworkEvent.builder(Type.SENT, 1).setUncompressedMessageSize(27).build(), events.get(1));
assertEquals(
NetworkEvent.builder(Type.RECV, 0)
.setCompressedMessageSize(255)
.setUncompressedMessageSize(90)
.build(),
events.get(2));
inOrder.verify(spyServerSpan).end(
EndSpanOptions.builder()
.setStatus(io.opencensus.trace.Status.CANCELLED)
.setSampleToLocalSpanStore(false)
.build());
verifyNoMoreInteractions(spyServerSpan);
}
示例15: getServerTracerFactory
import io.grpc.ServerStreamTracer; //導入方法依賴的package包/類
/**
* Returns the server tracer factory.
*/
ServerStreamTracer.Factory getServerTracerFactory() {
return serverTracerFactory;
}