use of akka.http.scaladsl.server.RequestContextImpl in project pinpoint by naver.
the class DirectivesInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
int requestContextIndex = getArgsIndexOfRequestContext(args);
if (requestContextIndex == -1) {
return;
}
if (traceContext.currentTraceObject() != null) {
return;
}
RequestContextImpl requestContext = (RequestContextImpl) args[requestContextIndex];
if (!(requestContext instanceof AsyncContextAccessor)) {
if (isDebug) {
logger.debug("Invalid requestContext. Need metadata accessor({}).", AsyncContextAccessor.class.getName());
}
return;
}
akka.http.scaladsl.model.HttpRequest request = requestContext.request();
final Trace trace = createTrace(request);
if (trace == null || !trace.canSampled()) {
return;
}
final SpanEventRecorder recorder = trace.traceBlockBegin();
recorder.recordServiceType(AkkaHttpConstants.AKKA_HTTP_SERVER_INTERNAL);
final AsyncContext asyncContext = recorder.recordNextAsyncContext(true);
((AsyncContextAccessor) requestContext)._$PINPOINT$_setAsyncContext(asyncContext);
if (isDebug) {
logger.debug("Set closeable-AsyncContext {}", asyncContext);
}
}
Aggregations