Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(tracing): Add total traces column to users table (#19221)

Ben Bacheme7e1f33ba78d
diff --git a/web/src/features/users/UsersTable.tsx b/web/src/features/users/UsersTable.tsx
index d9ff72bc28..3731459596 100644
--- a/web/src/features/users/UsersTable.tsx
+++ b/web/src/features/users/UsersTable.tsx
@@ -61,6 +61,7 @@ type RowData = {
firstEvent: string;
lastEvent: string;
totalEvents: string;
+ totalTraces: string;
totalTokens: string;
totalCost: string;
};
@@ -349,13 +350,17 @@ export function UsersTable({
type UserCoreOutput = RouterOutput["users"]["all"]["users"][number];
type UserMetricsOutput = RouterOutput["users"]["metrics"][number];
- type CoreType = Omit<UserCoreOutput, "userId"> & { id: string };
+ type CoreType = Omit<UserCoreOutput, "userId"> & {
+ id: string;
+ traceCount: UserCoreOutput["totalTraces"];
+ };
type MetricType = Omit<UserMetricsOutput, "userId"> & { id: string };
const userRowData = joinTableCoreAndMetrics<CoreType, MetricType>(
users.data?.users.map((u) => ({
...u,
id: u.userId,
+ traceCount: u.totalTraces,
})),
userMetrics.data?.map((u) => ({
...u,
@@ -426,6 +431,13 @@ export function UsersTable({
mapValue: (value) =>
userMetrics.isSuccess ? (value ?? undefined) : { type: "loading" },
}),
+ createTextTableColumn<RowData>({
+ accessorKey: "totalTraces",
+ header: "Trace Count",
+ size: 120,
+ mapValue: (value) =>
+ users.isSuccess ? (value ?? undefined) : { type: "loading" },
+ }),
createTextTableColumn<RowData>({
accessorKey: "totalEvents",
header: "Total Events",
@@ -589,6 +601,9 @@ export function UsersTable({
return {
userId: t.id,
environment: t.environment ?? undefined,
+ totalTraces: compactNumberFormatter(
+ Number(t.traceCount),
+ ),
firstEvent:
t.firstTrace?.toLocaleString() ?? "No event yet",
lastEvent: