-
Notifications
You must be signed in to change notification settings - Fork 326
Open
Labels
Description
We kindly ask to post all questions and issues on the Discuss forum first. In addition to awesome, knowledgeable community contributors, core APM developers are on the forums every single day to help you out as well, so your questions will reach a wider audience there. If we confirm that there is a bug, then you can open an issue in this repo.
Describe the bug
since vesion 1.30, can not get trace.id from MDC
Steps to reproduce
@ControllerAdvice
@Slf4j
public class GlobalResponseBodyAdvice implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
return true;
}
@Override
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
log.info("trace.id:{}", MDC.get("trace.id"));
return body;
}
}
agent jar: elastic-apm-agent-1.30.1.jar or after this version
call MDC.get("trace.id"), it returns null

agent jar: elastic-apm-agent-1.29.0.jar
call MDC.get("trace.id"), it returns the correct string

Expected behavior
call MDC.get("trace.id"), it should return the correct string.
or how can I get correct string
Debug logs
Click to expand
replace this line with your debug logs