getsentry / getsentry/sentry-python

Set `gen_ai.response.id` on `gen_ai.chat` spans

Open
#5,833 1 comment 0 reactions 0 assignees View on GitHub
Improvement Python Spans
Dominant language
Python
Stars
2.2k
Forks
669
Avg merge
1d 40m
Merged PRs (30d)
212

Description

Extract `response_id` from pydantic-ai's `ModelResponse` and set it as `gen_ai.response.id` in `update_ai_client_span()` in `sentry_sdk/integrations/pydantic_ai/spans/ai_client.py`.

This is a recommended OTel attribute, useful for correlating spans with provider dashboards/logs. We already have `SPANDATA.GEN_AI_RESPONSE_ID` defined in `consts.py`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.