-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(trace-view): format dollars #101423
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
feat(trace-view): format dollars #101423
Conversation
ArthurKnaus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
…h-cost-calculation
| }, | ||
| [SpanFields.GEN_AI_USAGE_TOTAL_COST]: (props: CustomRenderersProps) => { | ||
| return formatDollars(+Number(props.item.value).toFixed(10)); | ||
| }, |
There was a problem hiding this comment.
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.
| 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', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closes TET-1256: Fix floating point issues with cost calculation