Skip to content

feat(ai): Add gen_ai_cost_total_tokens field and deprecate old version#126

Merged
vgrozdanic merged 3 commits intomainfrom
vg/new-cost-attr
Sep 9, 2025
Merged

feat(ai): Add gen_ai_cost_total_tokens field and deprecate old version#126
vgrozdanic merged 3 commits intomainfrom
vg/new-cost-attr

Conversation

@vgrozdanic
Copy link
Member

@vgrozdanic vgrozdanic commented Sep 8, 2025

Introduce gen_ai_cost_total_tokens and double write total tokens cost to it and to gen_ai_usage_total_cost for the next 90 days (until the data expires).

After that the plan is to completely deprecate gen_ai_usage_total_cost field to have all the cost related fields under gen_ai.cost.*.

Part of TET-1100: Update relay and conventions to reduce work scattering

@vgrozdanic vgrozdanic requested a review from a team September 8, 2025 08:41
@linear
Copy link

linear bot commented Sep 8, 2025

*
* Attribute defined in OTEL: No
*
* @deprecated Use {@link GEN_AI_COST_TOTAL_TOKENS} (gen_ai.cost.total_tokens) instead
Copy link
Member

Choose a reason for hiding this comment

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

Should the associated type GEN_AI_USAGE_TOTAL_COST_TYPE also be marked as deprecated?

Copy link
Member

Choose a reason for hiding this comment

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

Good point, we should also mark the associated types as deprecated during code generation.

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 have only changed json file, everything else was generated

Copy link
Member Author

Choose a reason for hiding this comment

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

@lcian is that something that needs to be changed in the generation script, or in this PR?

Even if i change it now, and someone re-generates attributes.ts, that will be overwritten, right?

Copy link
Member

@lcian lcian Sep 9, 2025

Choose a reason for hiding this comment

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

Yep the logic needs to be changed in the generation script.
You should only touch the JSONs inside model/, everything else is generated.

Copy link
Member

@shellmayr shellmayr 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 👍

vgrozdanic and others added 2 commits September 9, 2025 14:32
Co-authored-by: Lorenzo Cian <lorenzo.cian@sentry.io>
@vgrozdanic vgrozdanic merged commit 50c1b9b into main Sep 9, 2025
5 checks passed
@vgrozdanic vgrozdanic deleted the vg/new-cost-attr branch September 9, 2025 12:50
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.

3 participants