Skip to content

Commit

Permalink
Trace tree
Browse files Browse the repository at this point in the history
  • Loading branch information
tssweeney committed Mar 4, 2025
1 parent 4767469 commit cc7ae95
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
20 changes: 10 additions & 10 deletions weave-js/src/components/PagePanelComponents/Home/Browse3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,11 @@ const useURLBackedCallPageState = () => {
setShowFeedback(getOptionalBoolean(query, SHOW_FEEDBACK_PARAM));
}, [query]);

const [hideTracetree, setHideTracetree] = useState<boolean | undefined>(
const [hideTraceTree, setHideTraceTree] = useState<boolean | undefined>(
getOptionalBoolean(query, HIDE_TRACETREE_PARAM)
);
useEffect(() => {
setHideTracetree(getOptionalBoolean(query, HIDE_TRACETREE_PARAM));
setHideTraceTree(getOptionalBoolean(query, HIDE_TRACETREE_PARAM));
}, [query]);

const debouncedHistoryPush = useMemo(() => {
Expand All @@ -684,7 +684,7 @@ const useURLBackedCallPageState = () => {
'',
rootCallId,
descendentCallId,
hideTracetree,
hideTraceTree,
showFeedback
)
);
Expand All @@ -699,7 +699,7 @@ const useURLBackedCallPageState = () => {
rootCallId,
descendentCallId,
showFeedback,
hideTracetree,
hideTraceTree,
]);

return {
Expand All @@ -708,11 +708,11 @@ const useURLBackedCallPageState = () => {
rootCallId,
descendentCallId,
showFeedback,
hideTracetree,
hideTraceTree,
setRootCallId,
setDescendentCallId,
setShowFeedback,
setHideTracetree,
setHideTraceTree,
};
};

Expand All @@ -725,11 +725,11 @@ const CallPageBinding = () => {
rootCallId,
descendentCallId,
showFeedback,
hideTracetree,
hideTraceTree,
setRootCallId,
setDescendentCallId,
setShowFeedback,
setHideTracetree,
setHideTraceTree,
} = useURLBackedCallPageState();

return (
Expand All @@ -740,8 +740,8 @@ const CallPageBinding = () => {
setRootCallId={setRootCallId}
descendentCallId={descendentCallId}
setDescendentCallId={setDescendentCallId}
hideTracetree={hideTracetree}
setHideTracetree={setHideTracetree}
hideTraceTree={hideTraceTree}
setHideTraceTree={setHideTraceTree}
showFeedback={showFeedback}
setShowFeedback={setShowFeedback}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const browse2Context = {
traceId: string,
callId: string,
descendentCallId?: string,
hideTracetree?: boolean,
hideTraceTree?: boolean,
showFeedback?: boolean
) => {
return `/${entityName}/${projectName}/trace/${traceId}/${callId}`;
Expand Down Expand Up @@ -352,16 +352,16 @@ export const browse3ContextGen = (
traceId: string,
callId: string,
descendentCallId?: string,
hideTracetree?: boolean,
hideTraceTree?: boolean,
showFeedback?: boolean
) => {
let url = `${projectRoot(entityName, projectName)}/calls/${callId}`;
const params = new URLSearchParams();
if (descendentCallId) {
params.set(DESCENDENT_CALL_ID_PARAM, descendentCallId);
}
if (hideTracetree !== undefined) {
params.set(HIDE_TRACETREE_PARAM, hideTracetree ? '1' : '0');
if (hideTraceTree !== undefined) {
params.set(HIDE_TRACETREE_PARAM, hideTraceTree ? '1' : '0');
}
if (showFeedback !== undefined) {
params.set(SHOW_FEEDBACK_PARAM, showFeedback ? '1' : '0');
Expand Down Expand Up @@ -542,7 +542,7 @@ type RouteType = {
traceId: string,
callId: string,
descendentCallId?: string,
hideTracetree?: boolean,
hideTraceTree?: boolean,
showFeedback?: boolean
) => string;
tracesUIUrl: (entityName: string, projectName: string) => string;
Expand Down Expand Up @@ -624,7 +624,7 @@ const useSetSearchParam = () => {
};

export const PEEK_PARAM = 'peekPath';
export const HIDE_TRACETREE_PARAM = 'hideTracetree';
export const HIDE_TRACETREE_PARAM = 'hideTraceTree';
export const SHOW_FEEDBACK_PARAM = 'showFeedback';
export const DESCENDENT_CALL_ID_PARAM = 'descendentCallId';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type CallPageProps = {
setRootCallId: (callId: string) => void;
descendentCallId?: string;
setDescendentCallId: (descendentCallId: string | undefined) => void;
hideTracetree?: boolean;
setHideTracetree: (hideTracetree: boolean | undefined) => void;
hideTraceTree?: boolean;
setHideTraceTree: (hideTraceTree: boolean | undefined) => void;
showFeedback?: boolean;
setShowFeedback: (showFeedback: boolean | undefined) => void;
};
Expand Down Expand Up @@ -232,37 +232,37 @@ const CallPageInnerVertical: FC<CallPageInnerProps> = ({
descendentCall: call,
descendentCallId: callId,
setRootCallId: setCallId,
setHideTracetree,
setHideTraceTree,
setShowFeedback,
showFeedback,
hideTracetree,
hideTraceTree,
}) => {
useViewTraceEvent(call);
const callIsCached = call.callId !== callId;

const hideTraceTreeDefault = isEvaluateOp(call.spanName);
const showFeedbackDefault = false;
const hideTraceTree =
hideTracetree != null ? hideTracetree : hideTraceTreeDefault;
const showFeedbackExpand =
const hideTraceTreeActual =
hideTraceTree != null ? hideTraceTree : hideTraceTreeDefault;
const showFeedbackActual =
showFeedback != null ? showFeedback : showFeedbackDefault;

const onToggleTraceTree = useCallback(() => {
const targetValue = !hideTraceTree;
const targetValue = !hideTraceTreeActual;
if (targetValue === hideTraceTreeDefault) {
setHideTracetree(undefined);
setHideTraceTree(undefined);
} else {
setHideTracetree(targetValue);
setHideTraceTree(targetValue);
}
}, [hideTraceTree, hideTraceTreeDefault, setHideTracetree]);
}, [hideTraceTreeActual, hideTraceTreeDefault, setHideTraceTree]);
const onToggleFeedbackExpand = useCallback(() => {
const targetValue = !showFeedbackExpand;
const targetValue = !showFeedbackActual;
if (targetValue === showFeedbackDefault) {
setShowFeedback(undefined);
} else {
setShowFeedback(targetValue);
}
}, [setShowFeedback, showFeedbackDefault, showFeedbackExpand]);
}, [setShowFeedback, showFeedbackDefault, showFeedbackActual]);

const {humanAnnotationSpecs, specsLoading} = useHumanAnnotationSpecs(
call.entity,
Expand Down Expand Up @@ -291,23 +291,23 @@ const CallPageInnerVertical: FC<CallPageInnerProps> = ({
<Box sx={{marginLeft: showPaginationControls ? 0 : 'auto'}}>
<Button
icon="layout-tabs"
tooltip={`${!hideTraceTree ? 'Hide' : 'Show'} trace tree`}
tooltip={`${!hideTraceTreeActual ? 'Hide' : 'Show'} trace tree`}
variant="ghost"
active={!hideTraceTree}
active={!hideTraceTreeActual}
onClick={onToggleTraceTree}
/>
<Button
icon="marker"
tooltip={`${showFeedbackExpand ? 'Hide' : 'Show'} feedback`}
tooltip={`${showFeedbackActual ? 'Hide' : 'Show'} feedback`}
variant="ghost"
active={showFeedbackExpand ?? false}
active={showFeedbackActual ?? false}
onClick={onToggleFeedbackExpand}
className="ml-4"
/>
</Box>
</Box>
}
isRightSidebarOpen={showFeedbackExpand}
isRightSidebarOpen={showFeedbackActual}
rightSidebarContent={
<Tailwind style={{display: 'contents'}}>
<div className="flex h-full flex-col">
Expand All @@ -322,7 +322,7 @@ const CallPageInnerVertical: FC<CallPageInnerProps> = ({
</Tailwind>
}
headerContent={<CallOverview call={call} />}
isLeftSidebarOpen={!hideTraceTree}
isLeftSidebarOpen={!hideTraceTreeActual}
leftSidebarContent={
<Tailwind style={{display: 'contents'}}>
<div className="h-full bg-moon-50">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export const CallLink: React.FC<{
: undefined;
// default to true if not specified and not an eval
const traceTreeParam = peekParams.get(HIDE_TRACETREE_PARAM);
const hideTracetree =
const hideTraceTree =
traceTreeParam === '1'
? true
: traceTreeParam === '0'
Expand All @@ -342,7 +342,7 @@ export const CallLink: React.FC<{
'',
props.callId,
descendentCallId,
hideTracetree,
hideTraceTree,
showFeedbackExpand
);

Expand Down

0 comments on commit cc7ae95

Please sign in to comment.