getsentry / getsentry/sentry-python

Add `gen_ai.request.choice.count` attribute (candidate_count)

Đang mở
#5,816 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Improvement 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

OTel GenAI semconv conditionally requires `gen_ai.request.choice.count` "if available and != 1". Google's `GenerateContentConfig` has `candidate_count` but it is not captured.

## Context

This attribute helps understand when users request multiple response candidates, which impacts token usage and cost.

## Files

* `sentry_sdk/integrations/google_genai/utils.py` — `set_span_data_for_request()`
* `sentry_sdk/consts.py` — uses `SPANDATA.GEN_AI_CHOICE` which maps to `gen_ai.choice`

## Acceptance Criteria

* `candidate_count` from config is captured on the span when present and != 1
* Test added to verify the attribute is set

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.