🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(dashboard): pass v2 metrics version to custom dashboard widgets (#12177)
Valery Meleshkinfbf3e6c7771b
diff --git a/web/src/features/widgets/components/DashboardWidget.tsx b/web/src/features/widgets/components/DashboardWidget.tsxindex 389bc928ef..9e54ff278c 100644--- a/web/src/features/widgets/components/DashboardWidget.tsx+++ b/web/src/features/widgets/components/DashboardWidget.tsx@@ -21,6 +21,8 @@ import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccesimport { showErrorToast } from "@/src/features/notifications/showErrorToast";import { DownloadButton } from "@/src/features/widgets/chart-library/DownloadButton";import { formatMetricName } from "@/src/features/widgets/utils";+import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";+import { type ViewVersion } from "@/src/features/query";export interface WidgetPlacement {id: string;@@ -51,6 +53,8 @@ export function DashboardWidget({}) {const router = useRouter();const utils = api.useUtils();+ const { isBetaEnabled } = useV4Beta();+ const metricsVersion: ViewVersion = isBetaEnabled ? "v2" : "v1";const widget = api.dashboardWidgets.get.useQuery({widgetId: placement.widgetId,@@ -94,6 +98,7 @@ export function DashboardWidget({const queryResult = api.dashboard.executeQuery.useQuery({projectId,+ version: metricsVersion,query: {view: (widget.data?.view as z.infer<typeof views>) ?? "traces",dimensions: widget.data?.dimensions ?? [],