-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OPIK-621] [Error tracking] [FE] Add Trace/Span error tracking support (
#904)
- Loading branch information
1 parent
489d288
commit b8b0482
Showing
11 changed files
with
153 additions
and
13 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
45 changes: 45 additions & 0 deletions
45
apps/opik-frontend/src/components/shared/DataTableCells/ErrorCell.tsx
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,45 @@ | ||
import { CellContext } from "@tanstack/react-table"; | ||
import CellWrapper from "@/components/shared/DataTableCells/CellWrapper"; | ||
import TooltipWrapper from "@/components/shared/TooltipWrapper/TooltipWrapper"; | ||
import { ROW_HEIGHT } from "@/types/shared"; | ||
import { BaseTraceDataErrorInfo } from "@/types/traces"; | ||
|
||
const ErrorCell = <TData,>( | ||
context: CellContext<TData, BaseTraceDataErrorInfo | undefined>, | ||
) => { | ||
const value = context.getValue(); | ||
|
||
if (!value) return null; | ||
|
||
const rowHeight = | ||
context.column.columnDef.meta?.overrideRowHeight ?? | ||
context.table.options.meta?.rowHeight ?? | ||
ROW_HEIGHT.small; | ||
|
||
const isSmall = rowHeight === ROW_HEIGHT.small; | ||
|
||
return ( | ||
<CellWrapper | ||
metadata={context.column.columnDef.meta} | ||
tableMetadata={context.table.options.meta} | ||
> | ||
<TooltipWrapper | ||
content={ | ||
value.message | ||
? `Message: ${value.message}` | ||
: "Error message is not specified" | ||
} | ||
> | ||
{isSmall ? ( | ||
<span className="truncate">{value.exception_type}</span> | ||
) : ( | ||
<div className="size-full overflow-y-auto"> | ||
{value.exception_type} | ||
</div> | ||
)} | ||
</TooltipWrapper> | ||
</CellWrapper> | ||
); | ||
}; | ||
|
||
export default ErrorCell; |
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
53 changes: 53 additions & 0 deletions
53
apps/opik-frontend/src/components/shared/TraceDetailsPanel/TraceDataViewer/ErrorTab.tsx
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,53 @@ | ||
import React from "react"; | ||
import { Span, Trace } from "@/types/traces"; | ||
import { | ||
Accordion, | ||
AccordionContent, | ||
AccordionItem, | ||
AccordionTrigger, | ||
} from "@/components/ui/accordion"; | ||
|
||
type ErrorTabProps = { | ||
data: Trace | Span; | ||
}; | ||
|
||
const ErrorTab: React.FunctionComponent<ErrorTabProps> = ({ data }) => { | ||
const error = data.error_info!; | ||
|
||
return ( | ||
<Accordion | ||
type="multiple" | ||
className="w-full" | ||
defaultValue={["type", "message", "traceback"]} | ||
> | ||
<AccordionItem value="type"> | ||
<AccordionTrigger>Exception type</AccordionTrigger> | ||
<AccordionContent> | ||
<div className="whitespace-pre-wrap break-words rounded-md bg-primary-foreground px-4 py-2"> | ||
{error.exception_type} | ||
</div> | ||
</AccordionContent> | ||
</AccordionItem> | ||
{error.message && ( | ||
<AccordionItem value="message"> | ||
<AccordionTrigger>Message</AccordionTrigger> | ||
<AccordionContent> | ||
<div className="whitespace-pre-wrap break-words rounded-md bg-primary-foreground px-4 py-2"> | ||
{error.message} | ||
</div> | ||
</AccordionContent> | ||
</AccordionItem> | ||
)} | ||
<AccordionItem value="traceback"> | ||
<AccordionTrigger>Traceback</AccordionTrigger> | ||
<AccordionContent> | ||
<div className="whitespace-pre-wrap break-words rounded-md bg-primary-foreground px-4 py-2"> | ||
{error.traceback} | ||
</div> | ||
</AccordionContent> | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
}; | ||
|
||
export default ErrorTab; |
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
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
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