Skip to content

Rename legacy ai.* attributes to gen_ai.* names. #4924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 23, 2025

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented Jul 9, 2025

This makes the names OTel compatible and also allows older SDKs that use the legacy names to send spans that will appear in the AI agents insights module.

Those are matching the deprecated ai.* attributes described in the Sentry conventions:
https://getsentry.github.io/sentry-conventions/generated/attributes/ai.html#deprecated-attributes

We have checked if those attributes are used by customers in alerts, dashboards and saved queries. They are NOT used, so we can safely normalize them.

Fixes getsentry/sentry-python#4516

@antonpirker antonpirker marked this pull request as ready for review July 9, 2025 09:19
@antonpirker antonpirker requested a review from a team as a code owner July 9, 2025 09:19
@@ -493,7 +493,7 @@ pub struct SpanData {
pub gen_ai_usage_output_tokens_reasoning: Annotated<Value>,

// Exact model used to generate the response (e.g. gpt-4o-mini-2024-07-18)
#[metastructure(field = "gen_ai.response.model")]
#[metastructure(field = "gen_ai.response.model", legacy_alias = "ai.model_id")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove ai_model_id field, since this is basically deprecating it. Not sure if it needs to be done as a part of this PR, or if follow-up is fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. I also fixed it so now ai.model_id is an correct alias to gen_ai.request.model. (and not response model)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also have deleted the ai_model_id field. This does not cause any problems if an SDK sends an ai.model_id right? (so relay will just save it as gen_ai_request_model and omit saving it in ai_model_id?)

@antonpirker antonpirker reopened this Jul 22, 2025
@antonpirker antonpirker requested a review from vgrozdanic July 23, 2025 08:06
Copy link
Member

@vgrozdanic vgrozdanic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, but you will still need an approve from code owner (ingest team)

@vgrozdanic vgrozdanic requested a review from a team July 23, 2025 08:39
Dav1dde

This comment was marked as outdated.

Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already got the @vgrozdanic stamp of approval :shipit:

@antonpirker antonpirker added this pull request to the merge queue Jul 23, 2025
Merged via the queue into master with commit 995bcfd Jul 23, 2025
28 checks passed
@antonpirker antonpirker deleted the antonpirker/ai-gen_ai-attributes-rename branch July 23, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If the attributes are NOT used, make relay to rename those span attributes
4 participants