diff --git a/web-common/src/features/dashboards/pivot/PivotError.svelte b/web-common/src/features/dashboards/pivot/PivotError.svelte
index e05d73091c3..1e3e8c2324c 100644
--- a/web-common/src/features/dashboards/pivot/PivotError.svelte
+++ b/web-common/src/features/dashboards/pivot/PivotError.svelte
@@ -1,8 +1,12 @@
Sorry, unexpected query error!
+ {#if traceIds.length > 0}
+
+ Trace ID{traceIds.length !== 1 ? "s" : ""}: {traceIds.join(", ")}
+
+ {/if}
One or more APIs failed with the following error{uniqueErrors.length !== 1
? "s"
@@ -28,9 +58,21 @@
{#each uniqueErrors as error}
-
-
{error.statusCode} :
-
{error.message}
+
+ {error.statusCode}:
+
+ {truncateMessage(error.message ?? "")}
+
+
{/each}
diff --git a/web-common/src/features/dashboards/pivot/pivot-utils.ts b/web-common/src/features/dashboards/pivot/pivot-utils.ts
index 680fc3f0644..548eeb3b9b0 100644
--- a/web-common/src/features/dashboards/pivot/pivot-utils.ts
+++ b/web-common/src/features/dashboards/pivot/pivot-utils.ts
@@ -640,6 +640,7 @@ export function getErrorFromResponse(
return {
statusCode: queryResult?.error?.response?.status || null,
message: queryResult?.error?.response?.data?.message,
+ traceId: queryResult?.error?.traceId,
};
}
diff --git a/web-common/src/features/dashboards/pivot/types.ts b/web-common/src/features/dashboards/pivot/types.ts
index 9f988dcb841..9ac280ff020 100644
--- a/web-common/src/features/dashboards/pivot/types.ts
+++ b/web-common/src/features/dashboards/pivot/types.ts
@@ -84,6 +84,7 @@ export interface PivotTimeConfig {
export interface PivotQueryError {
statusCode: number | null;
message?: string;
+ traceId?: string;
}
/**
diff --git a/web-common/src/runtime-client/fetchWrapper.ts b/web-common/src/runtime-client/fetchWrapper.ts
index b627fb26e48..8722d71b76b 100644
--- a/web-common/src/runtime-client/fetchWrapper.ts
+++ b/web-common/src/runtime-client/fetchWrapper.ts
@@ -17,6 +17,7 @@ export interface HTTPError {
};
message: string;
name: string;
+ traceId?: string;
}
export function isHTTPError(error: unknown): error is HTTPError {
@@ -69,6 +70,9 @@ export async function fetchWrapper({
if (resp.ok) return json;
+ // Extract trace ID from response headers
+ const traceId = resp.headers?.get("x-trace-id");
+
// Return runtime errors in the same form as the Axios client had previously
if (json?.code && json?.message) {
return Promise.reject({
@@ -76,11 +80,13 @@ export async function fetchWrapper({
status: resp.status,
data: json,
},
+ traceId,
});
} else {
// Fallback error handling
const err = new Error();
(err as any).response = json;
+ (err as any).traceId = traceId;
return Promise.reject(err);
}
}