-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(playground): show span details when playground run ends (#5108)
* feat: show span details * cleanup * fix
- Loading branch information
1 parent
ec65059
commit acce9d9
Showing
7 changed files
with
331 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from "react"; | ||
import { useLazyLoadQuery } from "react-relay"; | ||
import { graphql } from "relay-runtime"; | ||
|
||
import { Flex, View } from "@arizeai/components"; | ||
|
||
import { ExternalLink } from "@phoenix/components"; | ||
import { LatencyText } from "@phoenix/components/trace/LatencyText"; | ||
import { TokenCount } from "@phoenix/components/trace/TokenCount"; | ||
|
||
import { RunMetadataFooterQuery } from "./__generated__/RunMetadataFooterQuery.graphql"; | ||
|
||
export function RunMetadataFooter({ spanId }: { spanId: string }) { | ||
const data = useLazyLoadQuery<RunMetadataFooterQuery>( | ||
graphql` | ||
query RunMetadataFooterQuery($spanId: GlobalID!) { | ||
span: node(id: $spanId) { | ||
id | ||
... on Span { | ||
project { | ||
id | ||
} | ||
context { | ||
traceId | ||
spanId | ||
} | ||
tokenCountCompletion | ||
tokenCountPrompt | ||
tokenCountTotal | ||
latencyMs | ||
} | ||
} | ||
} | ||
`, | ||
{ spanId } | ||
); | ||
|
||
if (!data.span) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<View | ||
borderTopColor="light" | ||
borderTopWidth="thin" | ||
paddingStart="size-200" | ||
paddingEnd="size-200" | ||
paddingTop="size-100" | ||
paddingBottom="size-100" | ||
> | ||
<Flex direction="row" gap="size-200" justifyContent="space-between"> | ||
<Flex direction="row" gap="size-100"> | ||
<TokenCount | ||
tokenCountTotal={data.span.tokenCountTotal || 0} | ||
tokenCountPrompt={data.span.tokenCountPrompt || 0} | ||
tokenCountCompletion={data.span.tokenCountCompletion || 0} | ||
/> | ||
<LatencyText latencyMs={data.span.latencyMs || 0} /> | ||
</Flex> | ||
<ExternalLink | ||
href={`/projects/${data.span?.project?.id}/traces/${data.span?.context?.traceId}?selectedSpanId=${data.span?.context?.spanId}`} | ||
> | ||
View Trace | ||
</ExternalLink> | ||
</Flex> | ||
</View> | ||
); | ||
} |
53 changes: 39 additions & 14 deletions
53
app/src/pages/playground/__generated__/PlaygroundOutputSubscription.graphql.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.