getsentry / getsentry/sentry-python

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

Đang mở
#5,812 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Bug Python Spans
Ngôn ngữ chính
Python
Star
2.2k
Fork
669
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
213

Mô tả

## 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`:

```python
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.py` — `accumulate_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

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

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

Đánh giá

Issue này chưa được đánh giá.

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.