Java Code Examples for io.opencensus.trace.SpanContext#INVALID
The following examples show how to use
io.opencensus.trace.SpanContext#INVALID .
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: JaxrsContainerFilterTest.java From opencensus-java with Apache License 2.0 | 6 votes |
@Test public void testResponseFilter() throws Exception { Span span = new FakeSpan(SpanContext.INVALID, null); TagContext tagContext = mock(TagContext.class); HttpRequestContext context = JaxrsClientFilterTest.createHttpRequestContext(span, tagContext); UriInfo uriInfo = mock(UriInfo.class); when(uriInfo.getMatchedURIs()).thenReturn(Collections.singletonList("/resource/{route}")); ContainerRequestContext requestContext = mock(ContainerRequestContext.class); when(requestContext.getProperty("opencensus.context")).thenReturn(context); when(requestContext.getUriInfo()).thenReturn(uriInfo); ContainerResponseContext responseContext = mock(ContainerResponseContext.class); filter.filter(requestContext, responseContext); verify(requestContext).getProperty("opencensus.context"); verify(responseContext, times(1)).getStatus(); }
Example 2
Source File: JaxrsClientFilterTest.java From opencensus-java with Apache License 2.0 | 6 votes |
@Test public void testResponseFilter() throws Exception { Span span = new FakeSpan(SpanContext.INVALID, null); TagContext tagContext = mock(TagContext.class); HttpRequestContext context = createHttpRequestContext(span, tagContext); ClientRequestContext requestContext = mock(ClientRequestContext.class); when(requestContext.getProperty("opencensus.context")).thenReturn(context); ClientResponseContext responseContext = mock(ClientResponseContext.class); filter.filter(requestContext, responseContext); verify(requestContext).getProperty("opencensus.context"); verify(responseContext, times(1)).getStatus(); }
Example 3
Source File: CensusTracingModule.java From grpc-nebula-java with Apache License 2.0 | 5 votes |
@SuppressWarnings("ReferenceEquality") @Override public ServerStreamTracer newServerStreamTracer(String fullMethodName, Metadata headers) { SpanContext remoteSpan = headers.get(tracingHeader); if (remoteSpan == SpanContext.INVALID) { remoteSpan = null; } return new ServerTracer(fullMethodName, remoteSpan); }
Example 4
Source File: CensusTracingModule.java From grpc-java with Apache License 2.0 | 5 votes |
@SuppressWarnings("ReferenceEquality") @Override public ServerStreamTracer newServerStreamTracer(String fullMethodName, Metadata headers) { SpanContext remoteSpan = headers.get(tracingHeader); if (remoteSpan == SpanContext.INVALID) { remoteSpan = null; } return new ServerTracer(fullMethodName, remoteSpan); }
Example 5
Source File: MockSpan.java From styx with Apache License 2.0 | 4 votes |
public MockSpan() { super(SpanContext.INVALID, EnumSet.noneOf(Options.class)); }
Example 6
Source File: TextFormat.java From opencensus-java with Apache License 2.0 | 4 votes |
@Override public <C /*>>> extends @NonNull Object*/> SpanContext extract(C carrier, Getter<C> getter) { Utils.checkNotNull(carrier, "carrier"); Utils.checkNotNull(getter, "getter"); return SpanContext.INVALID; }
Example 7
Source File: BinaryFormat.java From opencensus-java with Apache License 2.0 | 4 votes |
@Override public SpanContext fromByteArray(byte[] bytes) { Utils.checkNotNull(bytes, "bytes"); return SpanContext.INVALID; }
Example 8
Source File: OpenCensusTraceLoggingEnhancer.java From opencensus-java with Apache License 2.0 | 4 votes |
private static SpanContext getCurrentSpanContext() { Span span = ContextUtils.getValue(Context.current()); return span == null ? SpanContext.INVALID : span.getContext(); }
Example 9
Source File: ContextDataUtils.java From opencensus-java with Apache License 2.0 | 4 votes |
private static SpanContext getCurrentSpanContext() { Span span = ContextUtils.getValue(Context.current()); return span == null ? SpanContext.INVALID : span.getContext(); }