Add `gen_ai.request.choice.count` attribute (candidate_count)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- observability
Research direction
Start in sentry_sdk/integrations/google_genai/utils.py at set_span_data_for_request(), then check sentry_sdk/consts.py to understand the existing SPANDATA.GEN_AI_CHOICE mapping. Capture candidate_count from the config only when it is present and not 1, and add a test verifying the span attribute is set.
Written by the indexing model from the issue text.
Description
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— usesSPANDATA.GEN_AI_CHOICEwhich maps togen_ai.choice
Acceptance Criteria
candidate_countfrom config is captured on the span when present and != 1- Test added to verify the attribute is set
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 672
- Avg merge
- 1d 13m
- Merged PRs (30d)
- 212
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from getsentry/sentry-python
-
Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsentry/sentry-python#7543 · 1 comment ·
-
Python
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getsentry/sentry-python#6992 · 1 comment ·
-
Improvement Python
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
getsentry/sentry-python#6970 · 1 comment ·
-
Bug Python
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
getsentry/sentry-python#6504 · 1 comment ·
-
Improvement Python Spans
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-python#5833 · 1 comment ·
All issues in getsentry/sentry-python
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100