use of akka.http.javadsl.model.HttpMethod in project pinpoint by naver.
the class DirectivesInterceptor method createTrace.
private Trace createTrace(final HttpRequest request) {
if (request == null) {
return null;
}
final String requestUri = String.valueOf(request.getUri());
if (requestUri != null && excludeUrlFilter.filter(requestUri)) {
// skip request.
if (isTrace) {
logger.trace("filter requestURI:{}", requestUri);
}
return null;
}
HttpMethod method = request.method();
if (method != null && excludeHttpMethodFilter.filter(method.value())) {
// skip request.
if (isTrace) {
logger.trace("filter http method:{}", method.value());
}
return null;
}
final boolean sampling = samplingEnable(request);
if (!sampling) {
final Trace trace = traceContext.disableSampling();
if (isDebug) {
logger.debug("Remote call sampling flag found. skip trace requestUrl:{}", requestUri);
}
return trace;
}
final TraceId traceId = populateTraceIdFromRequest(request);
if (traceId != null) {
final Trace trace = traceContext.continueAsyncTraceObject(traceId);
if (trace.canSampled()) {
final SpanRecorder recorder = trace.getSpanRecorder();
recordRootSpan(recorder, request);
if (isDebug) {
logger.debug("TraceID exist. continue trace. traceId:{}, requestUrl:{}", traceId, requestUri);
}
} else {
if (isDebug) {
logger.debug("TraceID exist. camSampled is false. skip trace. traceId:{}, requestUrl:{}", traceId, requestUri);
}
}
return trace;
} else {
final Trace trace = traceContext.newAsyncTraceObject();
if (trace.canSampled()) {
final SpanRecorder recorder = trace.getSpanRecorder();
recordRootSpan(recorder, request);
} else {
if (isDebug) {
logger.debug("Sampling is disabled");
}
}
return trace;
}
}
Aggregations