-
-
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
Merged
obostjancic
merged 3 commits into
master
from
ogi/tet-1256-fix-floating-point-issues-with-cost-calculation
Oct 14, 2025
Merged
feat(trace-view): format dollars #101423
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,13 +13,15 @@ import type {Project} from 'sentry/types/project'; | |
| import {trackAnalytics} from 'sentry/utils/analytics'; | ||
| import type {RenderFunctionBaggage} from 'sentry/utils/discover/fieldRenderers'; | ||
| import {FieldKey} from 'sentry/utils/fields'; | ||
| import {formatDollars} from 'sentry/utils/formatters'; | ||
| import {generateProfileFlamechartRoute} from 'sentry/utils/profiling/routes'; | ||
| import {ellipsize} from 'sentry/utils/string/ellipsize'; | ||
| import {looksLikeAJSONArray} from 'sentry/utils/string/looksLikeAJSONArray'; | ||
| import {looksLikeAJSONObject} from 'sentry/utils/string/looksLikeAJSONObject'; | ||
| import type {AttributesFieldRendererProps} from 'sentry/views/explore/components/traceItemAttributes/attributesTree'; | ||
| import {AttributesTree} from 'sentry/views/explore/components/traceItemAttributes/attributesTree'; | ||
| import type {TraceItemResponseAttribute} from 'sentry/views/explore/hooks/useTraceItemDetails'; | ||
| import {SpanFields} from 'sentry/views/insights/types'; | ||
| import {SectionKey} from 'sentry/views/issueDetails/streamline/context'; | ||
| import {FoldSection} from 'sentry/views/issueDetails/streamline/foldSection'; | ||
| import {TraceDrawerComponents} from 'sentry/views/performance/newTraceDetails/traceDrawer/details/styles'; | ||
|
|
@@ -165,6 +167,18 @@ export function Attributes({ | |
| }; | ||
| return <StyledLink to={target}>{props.item.value}</StyledLink>; | ||
| }, | ||
| [SpanFields.GEN_AI_COST_INPUT_TOKENS]: (props: CustomRenderersProps) => { | ||
| return formatDollars(+Number(props.item.value).toFixed(10)); | ||
| }, | ||
| [SpanFields.GEN_AI_COST_OUTPUT_TOKENS]: (props: CustomRenderersProps) => { | ||
| return formatDollars(+Number(props.item.value).toFixed(10)); | ||
| }, | ||
| [SpanFields.GEN_AI_COST_TOTAL_TOKENS]: (props: CustomRenderersProps) => { | ||
| return formatDollars(+Number(props.item.value).toFixed(10)); | ||
| }, | ||
| [SpanFields.GEN_AI_USAGE_TOTAL_COST]: (props: CustomRenderersProps) => { | ||
| return formatDollars(+Number(props.item.value).toFixed(10)); | ||
| }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Precision Loss in AI Cost RenderersThe AI cost custom renderers use |
||
| }; | ||
|
|
||
| // Some attributes (semantic or otherwise) look like they contain JSON-encoded | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: Missing AI Cost Fields in Number Fields
The new
GEN_AI_COST_INPUT_TOKENS,GEN_AI_COST_OUTPUT_TOKENS, andGEN_AI_COST_TOTAL_TOKENSfields are inSpanFieldsbut missing fromSpanNumberFields. These are numeric cost values, likeGEN_AI_USAGE_TOTAL_COST, and are typically formatted as dollars.