use of io.opencensus.contrib.http.HttpRequestContext in project instrumentation-java by census-instrumentation.
the class JaxrsContainerFilterTest method testResponseFilter.
@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();
}
use of io.opencensus.contrib.http.HttpRequestContext in project instrumentation-java by census-instrumentation.
the class JaxrsClientFilter method filter.
@Override
public void filter(ClientRequestContext requestContext) {
HttpRequestContext context = handler.handleStart(null, requestContext, requestContext);
requestContext.setProperty(OPENCENSUS_CONTEXT, context);
}
use of io.opencensus.contrib.http.HttpRequestContext in project instrumentation-java by census-instrumentation.
the class JaxrsClientFilter method filter.
@Override
public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
HttpRequestContext context = (HttpRequestContext) requestContext.getProperty(OPENCENSUS_CONTEXT);
handler.handleEnd(context, requestContext, responseContext, null);
}
Aggregations