本文整理匯總了Java中org.springframework.cloud.sleuth.instrument.web.TraceRequestAttributes類的典型用法代碼示例。如果您正苦於以下問題:Java TraceRequestAttributes類的具體用法?Java TraceRequestAttributes怎麽用?Java TraceRequestAttributes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TraceRequestAttributes類屬於org.springframework.cloud.sleuth.instrument.web包,在下文中一共展示了TraceRequestAttributes類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: filter
import org.springframework.cloud.sleuth.instrument.web.TraceRequestAttributes; //導入依賴的package包/類
@Override
public void filter(ContainerRequestContext containerRequestContext) throws IOException {
Span span = (Span) request.getAttribute(TraceFilter.class.getName() + ".TRACE");
if (span != null) {
span = tracer.createSpan(request.getServletPath() + request.getPathInfo(), span);
request.setAttribute(TraceRequestAttributes.HANDLED_SPAN_REQUEST_ATTR,
span);
}
}
示例2: filter
import org.springframework.cloud.sleuth.instrument.web.TraceRequestAttributes; //導入依賴的package包/類
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
Span span = (Span) request.getAttribute(TraceRequestAttributes.HANDLED_SPAN_REQUEST_ATTR);
if (span != null) {
tracer.close(span);
}
}
示例3: markRequestAsHandled
import org.springframework.cloud.sleuth.instrument.web.TraceRequestAttributes; //導入依賴的package包/類
private void markRequestAsHandled(RequestContext ctx) {
ctx.getRequest().setAttribute(TraceRequestAttributes.HANDLED_SPAN_REQUEST_ATTR, "true");
ctx.getRequest().setAttribute(TraceRequestAttributes.ERROR_HANDLED_SPAN_REQUEST_ATTR, "true");
}