use of com.nike.riposte.server.config.distributedtracing.DefaultRiposteServerSpanNamingAndTaggingStrategy in project riposte by Nike-Inc.
the class DTraceStartHandlerTest method beforeMethod.
@Before
public void beforeMethod() {
channelMock = mock(Channel.class);
ctxMock = mock(ChannelHandlerContext.class);
stateAttributeMock = mock(Attribute.class);
state = new HttpProcessingState();
httpRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/some/uri");
requestInfoMock = mock(RequestInfo.class);
doReturn(channelMock).when(ctxMock).channel();
doReturn(stateAttributeMock).when(channelMock).attr(ChannelAttributes.HTTP_PROCESSING_STATE_ATTRIBUTE_KEY);
doReturn(state).when(stateAttributeMock).get();
state.setRequestInfo(requestInfoMock);
initialSpanNameFromStrategy = new AtomicReference<>("span-name-from-strategy-" + UUID.randomUUID().toString());
strategyInitialSpanNameMethodCalled = new AtomicBoolean(false);
strategyRequestTaggingMethodCalled = new AtomicBoolean(false);
strategyResponseTaggingAndFinalSpanNameMethodCalled = new AtomicBoolean(false);
strategyInitialSpanNameArgs = new AtomicReference<>(null);
strategyRequestTaggingArgs = new AtomicReference<>(null);
strategyResponseTaggingArgs = new AtomicReference<>(null);
tagAndNamingStrategy = new ArgCapturingHttpTagAndSpanNamingStrategy<>(initialSpanNameFromStrategy, strategyInitialSpanNameMethodCalled, strategyRequestTaggingMethodCalled, strategyResponseTaggingAndFinalSpanNameMethodCalled, strategyInitialSpanNameArgs, strategyRequestTaggingArgs, strategyResponseTaggingArgs);
tagAndNamingAdapterMock = mock(HttpTagAndSpanNamingAdapter.class);
distributedTracingConfig = new DistributedTracingConfigImpl<>(new DefaultRiposteServerSpanNamingAndTaggingStrategy(tagAndNamingStrategy, tagAndNamingAdapterMock) {
@Override
public boolean shouldAddWireReceiveStartAnnotation() {
return shouldAddWireReceiveStartAnnotation;
}
@Override
public boolean shouldAddWireReceiveFinishAnnotation() {
return shouldAddWireReceiveFinishAnnotation;
}
}, DefaultRiposteProxyRouterSpanNamingAndTaggingStrategy.getDefaultInstance(), Span.class);
handler = new DTraceStartHandler(userIdHeaderKeys, distributedTracingConfig);
resetTracingAndMdc();
}
use of com.nike.riposte.server.config.distributedtracing.DefaultRiposteServerSpanNamingAndTaggingStrategy in project riposte by Nike-Inc.
the class HttpProcessingStateTest method beforeMethod.
@Before
public void beforeMethod() {
stateSpy = spy(new HttpProcessingState());
initialSpanNameFromStrategy = new AtomicReference<>("span-name-from-strategy-" + UUID.randomUUID().toString());
strategyInitialSpanNameMethodCalled = new AtomicBoolean(false);
strategyRequestTaggingMethodCalled = new AtomicBoolean(false);
strategyResponseTaggingAndFinalSpanNameMethodCalled = new AtomicBoolean(false);
strategyInitialSpanNameArgs = new AtomicReference<>(null);
strategyRequestTaggingArgs = new AtomicReference<>(null);
strategyResponseTaggingArgs = new AtomicReference<>(null);
wingtipsStrategy = new ArgCapturingHttpTagAndSpanNamingStrategy<>(initialSpanNameFromStrategy, strategyInitialSpanNameMethodCalled, strategyRequestTaggingMethodCalled, strategyResponseTaggingAndFinalSpanNameMethodCalled, strategyInitialSpanNameArgs, strategyRequestTaggingArgs, strategyResponseTaggingArgs);
wingtipsAdapterMock = mock(HttpTagAndSpanNamingAdapter.class);
serverTaggingStrategy = new DefaultRiposteServerSpanNamingAndTaggingStrategy(wingtipsStrategy, wingtipsAdapterMock);
requestMock = mock(RequestInfo.class);
responseMock = mock(ResponseInfo.class);
errorMock = mock(Throwable.class);
spanMock = mock(Span.class);
distributedTracingConfigMock = mock(DistributedTracingConfig.class);
doReturn(serverTaggingStrategy).when(distributedTracingConfigMock).getServerSpanNamingAndTaggingStrategy();
}
Aggregations