Java Code Examples for io.opentracing.tag.Tags#SPAN_KIND_CLIENT
The following examples show how to use
io.opentracing.tag.Tags#SPAN_KIND_CLIENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringWebSocketAgentIntercept.java From java-specialagent with Apache License 2.0 | 6 votes |
public static void messageChannelSend(final Object thiz) { final AbstractMessageChannel channel = (AbstractMessageChannel)thiz; for (final ChannelInterceptor interceptor : channel.getInterceptors()) if (interceptor instanceof TracingChannelInterceptor) return; final TracingChannelInterceptor tracingChannelInterceptor; if (channel.getBeanName().equals("clientOutboundChannel")) tracingChannelInterceptor = new TracingChannelInterceptor(GlobalTracer.get(), Tags.SPAN_KIND_CLIENT); else if (channel.getBeanName().equals("clientInboundChannel")) tracingChannelInterceptor = new TracingChannelInterceptor(GlobalTracer.get(), Tags.SPAN_KIND_SERVER); else return; channel.addInterceptor(tracingChannelInterceptor); }
Example 2
Source File: TracingChannelInterceptorTest.java From java-spring-cloud with Apache License 2.0 | 6 votes |
@Test public void testAfterMessageHandled() { Span span = mock(Span.class); Scope scope = mock(Scope.class); MessageHandler messageHandler = mock(WebSocketAnnotationMethodMessageHandler.class); MessageBuilder<String> messageBuilder = MessageBuilder.withPayload("Hi") .setHeader(TracingChannelInterceptor.SIMP_MESSAGE_TYPE, SimpMessageType.MESSAGE) .setHeader(TracingChannelInterceptor.SIMP_DESTINATION, TEST_DESTINATION) .setHeader(TracingChannelInterceptor.OPENTRACING_SCOPE, scope) .setHeader(TracingChannelInterceptor.OPENTRACING_SPAN, span); TracingChannelInterceptor interceptor = new TracingChannelInterceptor(mockTracer, Tags.SPAN_KIND_CLIENT); interceptor.afterMessageHandled(messageBuilder.build(), null, messageHandler, null); // Verify span is finished and scope is closed verify(span).finish(); verify(scope).close(); }
Example 3
Source File: SpanBuilderShim.java From opentelemetry-java with Apache License 2.0 | 5 votes |
@Override public SpanBuilder withTag(String key, String value) { if (Tags.SPAN_KIND.getKey().equals(key)) { switch (value) { case Tags.SPAN_KIND_CLIENT: spanKind = Kind.CLIENT; break; case Tags.SPAN_KIND_SERVER: spanKind = Kind.SERVER; break; case Tags.SPAN_KIND_PRODUCER: spanKind = Kind.PRODUCER; break; case Tags.SPAN_KIND_CONSUMER: spanKind = Kind.CONSUMER; break; default: spanKind = Kind.INTERNAL; break; } } else if (Tags.ERROR.getKey().equals(key)) { error = Boolean.parseBoolean(value); } else { this.spanBuilderAttributeKeys.add(key); this.spanBuilderAttributeValues.add(AttributeValue.stringAttributeValue(value)); } return this; }
Example 4
Source File: WebsocketAutoConfiguration.java From java-spring-cloud with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnBean(WebSocketMessageBrokerConfigurationSupport.class) public TracingChannelInterceptor tracingOutboundChannelInterceptor( WebSocketMessageBrokerConfigurationSupport config) { TracingChannelInterceptor interceptor = new TracingChannelInterceptor(tracer, Tags.SPAN_KIND_CLIENT); config.clientOutboundChannel().addInterceptor(interceptor); return interceptor; }
Example 5
Source File: OpenTracing0_33_BraveSpanTest.java From brave-opentracing with Apache License 2.0 | 5 votes |
@DataProvider public static Object[][] dataProviderKind() { return new Object[][] { {Tags.SPAN_KIND_CLIENT, Kind.CLIENT}, {Tags.SPAN_KIND_SERVER, Kind.SERVER}, {Tags.SPAN_KIND_PRODUCER, Kind.PRODUCER}, {Tags.SPAN_KIND_CONSUMER, Kind.CONSUMER} }; }
Example 6
Source File: DubboSofaTracerFilter.java From sofa-tracer with Apache License 2.0 | 4 votes |
private String spanKind(RpcContext rpcContext) { return rpcContext.isConsumerSide() ? Tags.SPAN_KIND_CLIENT : Tags.SPAN_KIND_SERVER; }
Example 7
Source File: DubboSofaTracerFilter.java From sofa-tracer with Apache License 2.0 | 4 votes |
private String spanKind(RpcContext rpcContext) { return rpcContext.isConsumerSide() ? Tags.SPAN_KIND_CLIENT : Tags.SPAN_KIND_SERVER; }