Skip to content
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(ui): condensed trace tree #4099

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app/src/components/trace/LatencyText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ import { formatFloat } from "@phoenix/utils/numberFormatUtils";
export function LatencyText({
latencyMs,
textSize = "medium",
showIcon = true,
}: {
latencyMs: number;
textSize?: TextProps["textSize"];
/**
* Whether to show the clock icon.
* @default true
*/
showIcon?: boolean;
}) {
const color = useMemo(() => {
if (latencyMs < 3000) {
Expand All @@ -36,9 +42,11 @@ export function LatencyText({
justifyContent="start"
gap="size-50"
>
<Text color={color} textSize={textSize}>
<Icon svg={<Icons.ClockOutline />} />
</Text>
{showIcon ? (
<Text color={color} textSize={textSize}>
<Icon svg={<Icons.ClockOutline />} />
</Text>
) : null}
<Text color={color} textSize={textSize}>
{latencyText}
</Text>
Expand Down
65 changes: 0 additions & 65 deletions app/src/components/trace/SpanItem.tsx

This file was deleted.

44 changes: 34 additions & 10 deletions app/src/components/trace/SpanKindIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from "react";
import { css } from "@emotion/react";

import { useTheme } from "@phoenix/contexts";

const ToolSVG = () => (
<svg
width="20"
Expand Down Expand Up @@ -547,44 +549,66 @@ export function SpanKindIcon({
spanKind: string;
variant?: "fill" | "outline";
}) {
const { theme } = useTheme();
const isDark = theme === "dark";
const isFilled = variant === "fill";
let icon = isFilled ? <UnknownFilledSVG /> : <UnknownSVG />;
let color = "--ac-global-color-grey-900";
let color = isDark
? "--ac-global-color-grey-600"
: "--ac-global-color-grey-500";
switch (spanKind) {
case "llm":
color = "--ac-global-color-orange-1000";
color = isDark
? "--ac-global-color-orange-1000"
: "--ac-global-color-orange-500";
icon = isFilled ? <LLMFilledSVG /> : <LLMSVG />;
break;
case "chain":
color = "--ac-global-color-blue-1000";
color = isDark
? "--ac-global-color-blue-1000"
: "--ac-global-color-blue-500";
icon = isFilled ? <ChainFilledSVG /> : <ChainSVG />;
break;
case "retriever":
color = "--ac-global-color-seafoam-1000";
color = isDark
? "--ac-global-color-seafoam-1000"
: "--ac-global-color-seafoam-500";
icon = isFilled ? <RetrieverFilledSVG /> : <RetrieverSVG />;
break;
case "embedding":
color = "--ac-global-color-indigo-1000";
color = isDark
? "--ac-global-color-indigo-1000"
: "--ac-global-color-indigo-500";
icon = isFilled ? <EmbeddingFilledSVG /> : <EmbeddingSVG />;
break;
case "agent":
color = "--ac-global-text-color-900";
color = isDark
? "--ac-global-text-color-900"
: "--ac-global-text-color-500";
icon = isFilled ? <AgentFilledSVG /> : <AgentSVG />;
break;
case "tool":
color = "--ac-global-color-yellow-1200";
color = isDark
? "--ac-global-color-yellow-1200"
: "--ac-global-color-yellow-500";
icon = isFilled ? <ToolFilledSVG /> : <ToolSVG />;
break;
case "reranker":
color = "--ac-global-color-celery-1000";
color = isDark
? "--ac-global-color-celery-1000"
: "--ac-global-color-celery-500";
icon = isFilled ? <RerankerFilledSVG /> : <RerankerSVG />;
break;
case "evaluator":
color = "--ac-global-color-indigo-1000";
color = isDark
? "--ac-global-color-indigo-1000"
Copy link
Contributor

@Parker-Stafford Parker-Stafford Aug 2, 2024

Choose a reason for hiding this comment

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

was the rotation not enough with the new filled icons?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah they get super dark. I adjusted them manually with Andy. I think this is necessary overall to make light mode look good

: "--ac-global-color-indigo-500";
icon = isFilled ? <EvaluatorFilledSVG /> : <EvaluatorSVG />;
break;
case "guardrail":
color = "--ac-global-color-fuchsia-1200";
color = isDark
? "--ac-global-color-fuchsia-1200"
: "--ac-global-color-fuchsia-500";
icon = isFilled ? <GuardrailFilledSVG /> : <GuardrailSVG />;
break;
}
Expand Down
Loading
Loading