Skip to content

Conversation

@obostjancic
Copy link
Member

@obostjancic obostjancic commented Oct 14, 2025

@linear
Copy link

linear bot commented Oct 14, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 14, 2025
Copy link
Member

@ArthurKnaus ArthurKnaus left a comment

Choose a reason for hiding this comment

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

🙌

@obostjancic obostjancic marked this pull request as ready for review October 14, 2025 11:37
@obostjancic obostjancic requested review from a team October 14, 2025 11:37
},
[SpanFields.GEN_AI_USAGE_TOTAL_COST]: (props: CustomRenderersProps) => {
return formatDollars(+Number(props.item.value).toFixed(10));
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Precision Loss in AI Cost Renderers

The AI cost custom renderers use toFixed(10) for precision, but the unary + operator immediately converts the result back to a number. This reintroduces floating point precision issues and removes trailing zeros, undermining the goal of accurate cost display.

Fix in Cursor Fix in Web

GEN_AI_TOOL_NAME = 'gen_ai.tool.name',
GEN_AI_COST_INPUT_TOKENS = 'gen_ai.cost.input_tokens',
GEN_AI_COST_OUTPUT_TOKENS = 'gen_ai.cost.output_tokens',
GEN_AI_COST_TOTAL_TOKENS = 'gen_ai.cost.total_tokens',
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Missing AI Cost Fields in Number Fields

The new GEN_AI_COST_INPUT_TOKENS, GEN_AI_COST_OUTPUT_TOKENS, and GEN_AI_COST_TOTAL_TOKENS fields are in SpanFields but missing from SpanNumberFields. These are numeric cost values, like GEN_AI_USAGE_TOTAL_COST, and are typically formatted as dollars.

Fix in Cursor Fix in Web

@obostjancic obostjancic merged commit d94aeeb into master Oct 14, 2025
45 checks passed
@obostjancic obostjancic deleted the ogi/tet-1256-fix-floating-point-issues-with-cost-calculation branch October 14, 2025 11:48
chromy pushed a commit that referenced this pull request Oct 17, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants