Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

since vesion 1.30, can not get trace.id from MDC

Đang mở
#3,865 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
backend, observability-sre

Hướng nghiên cứu

Bắt đầu với bản tái hiện GlobalResponseBodyAdvice được cung cấp và so sánh hành vi của MDC.get("trace.id") khi sử dụng elastic-apm-agent-1.29.0.jar với 1.30.1 và các phiên bản mới hơn. Điều tra tích hợp MDC của agent xung quanh điểm vào beforeBodyWrite, sử dụng debug logs để thu hẹp phạm vi regression. Được xem là hoàn tất khi trace ID khả dụng như mong đợi trong phiên bản bị ảnh hưởng hoặc cách được hỗ trợ để truy xuất nó đã được ghi lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

agent-java community

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
Image

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

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
Ngôn ngữ chính
Java
Star
593
Fork
338
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
13

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của elastic/apm-agent-java

Tất cả issue của elastic/apm-agent-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.