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

Issue with passing trace_entity when using ThreadPoolExecutor in lambda

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

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 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ệ
aws, python
Lĩnh vực
observability-sre

Hướng nghiên cứu

Bắt đầu với ví dụ ThreadPoolExecutor trong README và kiểm tra lớp ngữ cảnh tùy chỉnh được sử dụng cho các lambda, đặc biệt là cách các trace entity được khởi tạo và thiết lập. Tái hiện job đầu tiên được một thread xử lý và xác minh rằng subsegment của nó được gắn vào trace entity được cung cấp mà không cần gọi get_trace_entity trước đó.

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

Mô tả

I followed the instructions in the readme for passing the trace entity in a ThreadPoolExecutor but this does not appear to work properly in a lambda. The first time a thread does some work the trace_entity does not stick and the subsegment gets put under the root node not the one it should be assiciated with. The next time a thread picks up a job everything seems to operate fine.

I dug into the code a bit and it seems like there is a custome context class for lambdas but it does not override set_trace_entity to work properly with the other changes in the class. To workaround the issue I have found calling get_trace_entity before setting sets the internal state up properly.

example workaround from readme

def load_url(url, trace_entity):
    xray_recorder.get_trace_entity() # Workaround to setup internal state
    xray_recorder.set_trace_entity(trace_entity)

    resp = requests.get(url)

    xray_recorder.clear_trace_entities()
    return resp
Ngôn ngữ chính
Python
Star
339
Fork
147
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 aws/aws-xray-sdk-python

Tất cả issue của aws/aws-xray-sdk-python

Issue tương tự

Thêm issue về Python

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.