elastic / elastic/apm-agent-java
since vesion 1.30, can not get trace.id from MDC
- Dominant language
- Java
- Stars
- 594
- Forks
- 338
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 25
Description
We kindly ask to post all questions and issues on the [Discuss forum](https://discuss.elastic.co/c/apm) 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 {
@Override
public boolean supports(MethodParameter returnType, Class> converterType) {
return true;
}
@Override
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class> 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
```
Contributor guide
Assessment
This issue has not been assessed yet.