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: propagate error status codes to parent spans for improved visibility into trace exceptions #1824

Merged
merged 21 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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
5 changes: 5 additions & 0 deletions app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ type Span {
"""
cumulativeTokenCountCompletion: Int

"""
Propagated status code that percolates up error status codes from descendant spans (children, grandchildren, etc.)
"""
propagatedStatusCode: SpanStatusCode!

"""
Evaluations associated with the span, e.g. if the span is an LLM, an evaluation may assess the helpfulness of its response with respect to its input.
"""
Expand Down
6 changes: 3 additions & 3 deletions app/src/components/trace/SpanItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface SpanItemProps {
name: string;
spanKind: string;
latencyMs: number | null;
statusCode: SpanStatusCode;
propagatedStatusCode: SpanStatusCode;
axiomofjoy marked this conversation as resolved.
Show resolved Hide resolved
tokenCountTotal?: number | null;
tokenCountPrompt?: number | null;
tokenCountCompletion?: number | null;
Expand All @@ -24,7 +24,7 @@ export function SpanItem(props: SpanItemProps) {
name,
latencyMs,
spanKind,
statusCode,
propagatedStatusCode,
tokenCountTotal,
tokenCountPrompt,
tokenCountCompletion,
Expand Down Expand Up @@ -56,7 +56,7 @@ export function SpanItem(props: SpanItemProps) {
/>
) : null}
{latencyMs === null ? null : <LatencyText latencyMs={latencyMs} />}
{statusCode === "ERROR" ? (
{propagatedStatusCode === "ERROR" ? (
<SpanStatusCodeIcon statusCode="ERROR" />
) : null}
</Flex>
Expand Down
14 changes: 9 additions & 5 deletions app/src/components/trace/TraceTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ function SpanNodeWrap(props: PropsWithChildren<{ isSelected: boolean }>) {
* The line that connects the parent node to the child node edge
*/
function SpanTreeEdgeConnector({
statusCode,
propagatedStatusCode,
}: {
statusCode: SpanStatusCodeType;
propagatedStatusCode: SpanStatusCodeType;
axiomofjoy marked this conversation as resolved.
Show resolved Hide resolved
}) {
return (
<div
Expand All @@ -151,7 +151,7 @@ function SpanTreeEdgeConnector({
css={(theme) => css`
position: absolute;
border-left: 1px solid
${statusCode === "ERROR"
${propagatedStatusCode === "ERROR"
? theme.colors.statusDanger
: "rgb(204, 204, 204)"};
top: 0;
Expand All @@ -163,13 +163,17 @@ function SpanTreeEdgeConnector({
);
}

function SpanTreeEdge({ statusCode }: { statusCode: SpanStatusCodeType }) {
function SpanTreeEdge({
propagatedStatusCode,
}: {
propagatedStatusCode: SpanStatusCodeType;
}) {
return (
<div
aria-hidden="true"
css={(theme) => {
const color =
statusCode === "ERROR"
propagatedStatusCode === "ERROR"
? theme.colors.statusDanger
: "rgb(204, 204, 204)";
return css`
Expand Down
20 changes: 10 additions & 10 deletions app/src/components/trace/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("createSpanTree", () => {
{
spanKind: "chain",
name: "query",
statusCode: "OK",
propagatedStatusCode: "OK",
startTime: "2023-08-16T22:27:15.327378",
latencyMs: 2275,
parentId: null,
Expand All @@ -18,7 +18,7 @@ describe("createSpanTree", () => {
{
spanKind: "chain",
name: "synthesize",
statusCode: "OK",
propagatedStatusCode: "OK",
startTime: "2023-08-16T22:27:15.679981",
latencyMs: 1923,
parentId: "86d5abea-ca78-4e59-a3f7-02548bb4e19a",
Expand All @@ -30,7 +30,7 @@ describe("createSpanTree", () => {
{
spanKind: "llm",
name: "llm",
statusCode: "OK",
propagatedStatusCode: "OK",
startTime: "2023-08-16T22:27:15.681497",
latencyMs: 1921,
parentId: "6cd91cc2-c29d-45c9-b98b-dd37cffa1d7a",
Expand All @@ -43,7 +43,7 @@ describe("createSpanTree", () => {
{
spanKind: "retriever",
name: "retrieve",
statusCode: "OK",
propagatedStatusCode: "OK",
startTime: "2023-08-16T22:27:15.327415",
latencyMs: 352,
parentId: "86d5abea-ca78-4e59-a3f7-02548bb4e19a",
Expand All @@ -56,7 +56,7 @@ describe("createSpanTree", () => {
{
spanKind: "embedding",
name: "embedding",
statusCode: "OK",
propagatedStatusCode: "OK",
startTime: "2023-08-16T22:27:15.327439",
latencyMs: 118,
parentId: "de0d1e57-70d4-4b2b-a100-30b706902da3",
Expand All @@ -83,9 +83,9 @@ describe("createSpanTree", () => {
"latencyMs": 118,
"name": "embedding",
"parentId": "de0d1e57-70d4-4b2b-a100-30b706902da3",
"propagatedStatusCode": "OK",
"spanKind": "embedding",
"startTime": "2023-08-16T22:27:15.327439",
"statusCode": "OK",
},
},
],
Expand All @@ -97,9 +97,9 @@ describe("createSpanTree", () => {
"latencyMs": 352,
"name": "retrieve",
"parentId": "86d5abea-ca78-4e59-a3f7-02548bb4e19a",
"propagatedStatusCode": "OK",
"spanKind": "retriever",
"startTime": "2023-08-16T22:27:15.327415",
"statusCode": "OK",
"tokenCountTotal": null,
},
},
Expand All @@ -115,9 +115,9 @@ describe("createSpanTree", () => {
"latencyMs": 1921,
"name": "llm",
"parentId": "6cd91cc2-c29d-45c9-b98b-dd37cffa1d7a",
"propagatedStatusCode": "OK",
"spanKind": "llm",
"startTime": "2023-08-16T22:27:15.681497",
"statusCode": "OK",
"tokenCountTotal": null,
},
},
Expand All @@ -130,9 +130,9 @@ describe("createSpanTree", () => {
"latencyMs": 1923,
"name": "synthesize",
"parentId": "86d5abea-ca78-4e59-a3f7-02548bb4e19a",
"propagatedStatusCode": "OK",
"spanKind": "chain",
"startTime": "2023-08-16T22:27:15.679981",
"statusCode": "OK",
},
},
],
Expand All @@ -144,9 +144,9 @@ describe("createSpanTree", () => {
"latencyMs": 2275,
"name": "query",
"parentId": null,
"propagatedStatusCode": "OK",
"spanKind": "chain",
"startTime": "2023-08-16T22:27:15.327378",
"statusCode": "OK",
},
},
]
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/trace/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export interface ISpanItem {
name: string;
spanKind: string;
statusCode: SpanStatusCodeType;
propagatedStatusCode: SpanStatusCodeType;
axiomofjoy marked this conversation as resolved.
Show resolved Hide resolved
latencyMs: number | null;
startTime: string;
parentId: string | null;
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/trace/TracePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function TracePage() {
}
name
spanKind
statusCode
propagatedStatusCode
startTime
parentId
latencyMs
Expand Down
12 changes: 6 additions & 6 deletions app/src/pages/trace/__generated__/TracePageQuery.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/src/pages/tracing/SpansTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function SpansTable(props: SpansTableProps) {
span: node {
spanKind
name
statusCode
propagatedStatusCode
axiomofjoy marked this conversation as resolved.
Show resolved Hide resolved
startTime
latencyMs
tokenCountTotal
Expand Down Expand Up @@ -216,7 +216,7 @@ export function SpansTable(props: SpansTableProps) {
},
{
header: "status",
accessorKey: "statusCode",
accessorKey: "propagatedStatusCode",
enableSorting: false,
cell: ({ getValue }) => {
return <SpanStatusCodeIcon statusCode={getValue() as SpanStatusCode} />;
Expand Down
6 changes: 3 additions & 3 deletions app/src/pages/tracing/TracesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function TracesTable(props: TracesTableProps) {
rootSpan: node {
spanKind
name
statusCode
propagatedStatusCode
axiomofjoy marked this conversation as resolved.
Show resolved Hide resolved
startTime
latencyMs
tokenCountTotal: cumulativeTokenCountTotal
Expand All @@ -144,7 +144,7 @@ export function TracesTable(props: TracesTableProps) {
descendants {
spanKind
name
statusCode
propagatedStatusCode
axiomofjoy marked this conversation as resolved.
Show resolved Hide resolved
startTime
latencyMs
parentId
Expand Down Expand Up @@ -314,7 +314,7 @@ export function TracesTable(props: TracesTableProps) {
},
{
header: "status",
accessorKey: "statusCode",
accessorKey: "propagatedStatusCode",
enableSorting: false,
cell: ({ getValue }) => {
return <SpanStatusCodeIcon statusCode={getValue() as SpanStatusCode} />;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading