Bug: Streaming responses don't capture `response_id` or `model_version`

Đang mở Phù hợp với người mới
#5,812 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
observability

Hướng nghiên cứu

Bắt đầu trong sentry_sdk/integrations/google_genai/streaming.py tại accumulate_streaming_response(), sau đó so sánh cách xử lý metadata của response trong utils.py:886-890. Kiểm tra từng streaming chunk để tìm response_id và model_version, đồng thời thêm một test xác minh rằng cả hai trường của span đều được điền cho các streaming response.

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

Mô tả

Bug Python Spans

Problem

In streaming.py, the accumulate_streaming_response() function initializes response_id and model to None (lines 53-54) but never populates them from the streaming chunks. The accumulation loop (lines 56-83) never reads chunk.response_id or chunk.model_version.

This means streaming responses will always have null for gen_ai.response.id and gen_ai.response.model.

The non-streaming path correctly captures both in utils.py:886-890:

if getattr(response, "response_id", None):
    span.set_data(SPANDATA.GEN_AI_RESPONSE_ID, response.response_id)
if getattr(response, "model_version", None):
    span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, response.model_version)

Files

  • sentry_sdk/integrations/google_genai/streaming.pyaccumulate_streaming_response()

Acceptance Criteria

  • Streaming chunks are checked for response_id and model_version
  • gen_ai.response.id and gen_ai.response.model are populated on streaming spans
  • Test added to verify streaming responses capture these fields
Ngôn ngữ chính
Python
Star
2.2k
Fork
672
Merge trung bình
1 ngày 13 phút
Pull request đã merge (30 ngày)
212

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 getsentry/sentry-python

Tất cả issue của getsentry/sentry-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.