public class TraceIdLoggingWebMvcInterceptor extends Object implements org.springframework.web.servlet.HandlerInterceptor
HandlerInterceptor
that extracts the request
trace ID from the "x-cloud-trace-context" HTTP header and stores it in a thread-local
using TraceIdLoggingEnhancer.setCurrentTraceId(java.lang.String)
.
The TraceIdLoggingEnhancer
can then be used in a logging appender to add the
trace ID metadata to log messages.
Constructor and Description |
---|
TraceIdLoggingWebMvcInterceptor(TraceIdExtractor extractor) |
Modifier and Type | Method and Description |
---|---|
void |
afterCompletion(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
Object handler,
Exception e) |
TraceIdExtractor |
getTraceIdExtractor() |
boolean |
preHandle(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
Object handler) |
public TraceIdLoggingWebMvcInterceptor(TraceIdExtractor extractor)
public TraceIdExtractor getTraceIdExtractor()
public boolean preHandle(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, Object handler)
preHandle
in interface org.springframework.web.servlet.HandlerInterceptor
Copyright © 2021. All rights reserved.