diff --git a/app-server/src/db/trace.rs b/app-server/src/db/trace.rs index d1913b03..83bc0c14 100644 --- a/app-server/src/db/trace.rs +++ b/app-server/src/db/trace.rs @@ -67,7 +67,8 @@ pub async fn update_trace_attributes( session_id, trace_type, metadata, - has_browser_session + has_browser_session, + top_span_id ) VALUES ( $1, @@ -83,7 +84,8 @@ pub async fn update_trace_attributes( $11, COALESCE($12, 'DEFAULT'::trace_type), $13, - $14 + $14, + $15 ) ON CONFLICT(id) DO UPDATE @@ -96,10 +98,11 @@ pub async fn update_trace_attributes( cost = traces.cost + COALESCE($8, 0), start_time = CASE WHEN traces.start_time IS NULL OR traces.start_time > $9 THEN $9 ELSE traces.start_time END, end_time = CASE WHEN traces.end_time IS NULL OR traces.end_time < $10 THEN $10 ELSE traces.end_time END, - session_id = CASE WHEN traces.session_id IS NULL THEN $11 ELSE traces.session_id END, + session_id = COALESCE(traces.session_id, $11), trace_type = CASE WHEN $12 IS NULL THEN traces.trace_type ELSE COALESCE($12, 'DEFAULT'::trace_type) END, metadata = COALESCE($13, traces.metadata), - has_browser_session = COALESCE($14, traces.has_browser_session) + has_browser_session = COALESCE($14, traces.has_browser_session), + top_span_id = COALESCE(traces.top_span_id, $15) " ) .bind(attributes.id) @@ -116,6 +119,7 @@ pub async fn update_trace_attributes( .bind(&attributes.trace_type) .bind(&serde_json::to_value(&attributes.metadata).unwrap()) .bind(attributes.has_browser_session) + .bind(attributes.top_span_id) .execute(pool) .await?; Ok(()) diff --git a/app-server/src/traces/attributes.rs b/app-server/src/traces/attributes.rs index 706552da..e3744ac2 100644 --- a/app-server/src/traces/attributes.rs +++ b/app-server/src/traces/attributes.rs @@ -22,6 +22,7 @@ pub struct TraceAttributes { pub trace_type: Option, pub metadata: Option>, pub has_browser_session: Option, + pub top_span_id: Option, } impl TraceAttributes { @@ -82,4 +83,8 @@ impl TraceAttributes { pub fn set_has_browser_session(&mut self, has_browser_session: bool) { self.has_browser_session = Some(has_browser_session); } + + pub fn set_top_span_id(&mut self, top_span_id: Uuid) { + self.top_span_id = Some(top_span_id); + } } diff --git a/app-server/src/traces/utils.rs b/app-server/src/traces/utils.rs index bf935075..8aeb40aa 100644 --- a/app-server/src/traces/utils.rs +++ b/app-server/src/traces/utils.rs @@ -129,6 +129,10 @@ pub async fn record_span_to_db( } } }); + // Once we've set the parent span id, check if it's the top span + if span.parent_span_id.is_none() { + trace_attributes.set_top_span_id(span.span_id); + } span_attributes.update_path(); span.set_attributes(&span_attributes); diff --git a/frontend/app/api/projects/[projectId]/spans/[spanId]/basic-info/route.ts b/frontend/app/api/projects/[projectId]/spans/[spanId]/basic-info/route.ts new file mode 100644 index 00000000..4b52e68f --- /dev/null +++ b/frontend/app/api/projects/[projectId]/spans/[spanId]/basic-info/route.ts @@ -0,0 +1,30 @@ +// Returns span basic info that is shown in the traces table +// when traces arrive realtime + +import { and, eq } from 'drizzle-orm'; +import { NextResponse } from 'next/server'; + +import { db } from '@/lib/db/drizzle'; +import { spans } from '@/lib/db/migrations/schema'; + +export async function GET( + req: Request, + props: { params: Promise<{ projectId: string; spanId: string }> } +): Promise { + const params = await props.params; + const projectId = params.projectId; + const spanId = params.spanId; + + + const span = await db.query.spans.findFirst({ + where: and(eq(spans.spanId, spanId), eq(spans.projectId, projectId)), + columns: { + spanType: true, + name: true, + inputPreview: true, + outputPreview: true, + } + }); + + return NextResponse.json(span); +} diff --git a/frontend/app/api/projects/[projectId]/traces/route.ts b/frontend/app/api/projects/[projectId]/traces/route.ts index e91ef888..5926c55c 100644 --- a/frontend/app/api/projects/[projectId]/traces/route.ts +++ b/frontend/app/api/projects/[projectId]/traces/route.ts @@ -76,6 +76,8 @@ export async function GET( latency: sql`EXTRACT(EPOCH FROM (end_time - start_time))`.as("latency"), }).from(traces).leftJoin( topLevelSpans, + // We could as well join on eq(traces.topSpanId, topLevelSpans.id), + // but this is more performant, as spans are indexed by traceId eq(traces.id, topLevelSpans.traceId) ).where( and( @@ -204,6 +206,14 @@ export async function DELETE( ) ); + await db.delete(spans) + .where( + and( + inArray(traces.id, traceId), + eq(traces.projectId, projectId) + ) + ); + return new Response('Traces deleted successfully', { status: 200 }); } catch (error) { return new Response('Error deleting traces', { status: 500 }); diff --git a/frontend/components/traces/span-card.tsx b/frontend/components/traces/span-card.tsx index 40029e89..c79ffb10 100644 --- a/frontend/components/traces/span-card.tsx +++ b/frontend/components/traces/span-card.tsx @@ -1,4 +1,4 @@ -import { ChevronDown, ChevronRight, CircleX, X } from 'lucide-react'; +import { ChevronDown, ChevronRight, X } from 'lucide-react'; import React, { useEffect, useRef, useState } from 'react'; import { getDuration, getDurationString } from '@/lib/flow/utils'; diff --git a/frontend/components/traces/traces-table.tsx b/frontend/components/traces/traces-table.tsx index 53a0714e..64dc4d48 100644 --- a/frontend/components/traces/traces-table.tsx +++ b/frontend/components/traces/traces-table.tsx @@ -8,7 +8,7 @@ import DeleteSelectedRows from '@/components/ui/DeleteSelectedRows'; import { useProjectContext } from '@/contexts/project-context'; import { useUserContext } from '@/contexts/user-context'; import { useToast } from '@/lib/hooks/use-toast'; -import { SpanType, Trace, TraceWithSpans } from '@/lib/traces/types'; +import { SpanType, Trace } from '@/lib/traces/types'; import { isStringDateOld } from '@/lib/traces/utils'; import { DatatableFilter, PaginatedResponse } from '@/lib/types'; import { getFilterFromUrlParams } from '@/lib/utils'; @@ -151,6 +151,7 @@ export default function TracesTable({ onRowClick }: TracesTableProps) { cost: row.cost, metadata: row.metadata, hasBrowserSession: row.has_browser_session, + topSpanId: row.top_span_id, topSpanInputPreview: null, topSpanOutputPreview: null, topSpanName: null, @@ -159,16 +160,19 @@ export default function TracesTable({ onRowClick }: TracesTableProps) { }); // TODO: maybe also query top span input and output previews? - const getTraceTopSpanInfo = async (id: string): Promise<{ - topSpanName: string | null; - topSpanType: SpanType | null; + const getTraceTopSpanInfo = async (spanId: string): Promise<{ + topSpanName: string | null, + topSpanType: SpanType | null, + topSpanInputPreview: any | null, + topSpanOutputPreview: any | null, }> => { - const response = await fetch(`/api/projects/${projectId}/traces/${id}`); - const trace = await response.json() as TraceWithSpans; - const topSpan = trace.spans.find(span => span.parentSpanId === null); + const response = await fetch(`/api/projects/${projectId}/spans/${spanId}/basic-info`); + const span = await response.json(); return { - topSpanName: topSpan?.name ?? null, - topSpanType: topSpan?.spanType ?? null, + topSpanName: span?.name ?? null, + topSpanType: span?.spanType ?? null, + topSpanInputPreview: span?.inputPreview ?? null, + topSpanOutputPreview: span?.outputPreview ?? null, }; }; @@ -182,10 +186,10 @@ export default function TracesTable({ onRowClick }: TracesTableProps) { const insertIndex = currentTraces?.findIndex(trace => trace.startTime <= newObj.start_time); const newTraces = currentTraces ? [...currentTraces] : []; const rtEventTrace = dbTraceRowToTrace(newObj); - const { topSpanType, topSpanName, ...rest } = rtEventTrace; - const newTrace = (rtEventTrace.topSpanType === null) + const { topSpanType, topSpanName, topSpanInputPreview, topSpanOutputPreview, ...rest } = rtEventTrace; + const newTrace = (rtEventTrace.topSpanType === null && rtEventTrace.topSpanId != null) ? { - ...(await getTraceTopSpanInfo(rtEventTrace.id)), + ...(await getTraceTopSpanInfo(rtEventTrace.topSpanId)), ...rest, } : rtEventTrace; @@ -204,10 +208,10 @@ export default function TracesTable({ onRowClick }: TracesTableProps) { const newTraces = [...currentTraces]; const existingTrace = currentTraces[updateIndex]; const rtEventTrace = dbTraceRowToTrace(newObj); - const { topSpanType, topSpanName, ...rest } = rtEventTrace; - if (existingTrace.topSpanType === null) { + const { topSpanType, topSpanName, topSpanInputPreview, topSpanOutputPreview, ...rest } = rtEventTrace; + if (existingTrace.topSpanType === null && rtEventTrace.topSpanId != null) { const newTrace = { - ...(await getTraceTopSpanInfo(existingTrace.id)), + ...(await getTraceTopSpanInfo(rtEventTrace.topSpanId)), ...rest, }; newTraces[updateIndex] = newTrace; @@ -307,24 +311,24 @@ export default function TracesTable({ onRowClick }: TracesTableProps) { } }; - const handleAddFilter = (column: string, value: string) => { - const newFilter = { column, operator: 'eq', value }; - const existingFilterIndex = activeFilters.findIndex( - (filter) => filter.column === column && filter.value === value - ); + // const handleAddFilter = (column: string, value: string) => { + // const newFilter = { column, operator: 'eq', value }; + // const existingFilterIndex = activeFilters.findIndex( + // (filter) => filter.column === column && filter.value === value + // ); - let updatedFilters; - if (existingFilterIndex === -1) { + // let updatedFilters; + // if (existingFilterIndex === -1) { - updatedFilters = [...activeFilters, newFilter]; - } else { + // updatedFilters = [...activeFilters, newFilter]; + // } else { - updatedFilters = [...activeFilters]; - } + // updatedFilters = [...activeFilters]; + // } - setActiveFilters(updatedFilters); - updateUrlWithFilters(updatedFilters); - }; + // setActiveFilters(updatedFilters); + // updateUrlWithFilters(updatedFilters); + // }; const updateUrlWithFilters = (filters: DatatableFilter[]) => { searchParams.delete('filter'); diff --git a/frontend/lib/db/migrations/0022_hesitant_skin.sql b/frontend/lib/db/migrations/0022_hesitant_skin.sql new file mode 100644 index 00000000..1f18d191 --- /dev/null +++ b/frontend/lib/db/migrations/0022_hesitant_skin.sql @@ -0,0 +1 @@ +ALTER TABLE "traces" ADD COLUMN "top_span_id" uuid; \ No newline at end of file diff --git a/frontend/lib/db/migrations/meta/0022_snapshot.json b/frontend/lib/db/migrations/meta/0022_snapshot.json new file mode 100644 index 00000000..15ee5410 --- /dev/null +++ b/frontend/lib/db/migrations/meta/0022_snapshot.json @@ -0,0 +1,3032 @@ +{ + "id": "e1d09da1-b691-4e49-b8c6-11ea530a24be", + "prevId": "bd97755c-ae71-4808-b943-cc916ecd8120", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.api_keys": { + "name": "api_keys", + "schema": "", + "columns": { + "api_key": { + "name": "api_key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'default'" + } + }, + "indexes": { + "api_keys_user_id_idx": { + "name": "api_keys_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_keys_user_id_fkey": { + "name": "api_keys_user_id_fkey", + "tableFrom": "api_keys", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": { + "Enable insert for authenticated users only": { + "name": "Enable insert for authenticated users only", + "as": "PERMISSIVE", + "for": "ALL", + "to": [ + "service_role" + ], + "using": "true", + "withCheck": "true" + } + }, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.datapoint_to_span": { + "name": "datapoint_to_span", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "datapoint_id": { + "name": "datapoint_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "span_id": { + "name": "span_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "datapoint_to_span_datapoint_id_fkey": { + "name": "datapoint_to_span_datapoint_id_fkey", + "tableFrom": "datapoint_to_span", + "tableTo": "dataset_datapoints", + "columnsFrom": [ + "datapoint_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "datapoint_to_span_span_id_project_id_fkey": { + "name": "datapoint_to_span_span_id_project_id_fkey", + "tableFrom": "datapoint_to_span", + "tableTo": "spans", + "columnsFrom": [ + "span_id", + "project_id" + ], + "columnsTo": [ + "span_id", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "datapoint_to_span_pkey": { + "name": "datapoint_to_span_pkey", + "columns": [ + "datapoint_id", + "span_id", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dataset_datapoints": { + "name": "dataset_datapoints", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dataset_id": { + "name": "dataset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "indexed_on": { + "name": "indexed_on", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target": { + "name": "target", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "index_in_batch": { + "name": "index_in_batch", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": { + "dataset_datapoints_dataset_id_fkey": { + "name": "dataset_datapoints_dataset_id_fkey", + "tableFrom": "dataset_datapoints", + "tableTo": "datasets", + "columnsFrom": [ + "dataset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.datasets": { + "name": "datasets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "indexed_on": { + "name": "indexed_on", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "datasets_project_id_hash_idx": { + "name": "datasets_project_id_hash_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hash", + "with": {} + } + }, + "foreignKeys": { + "public_datasets_project_id_fkey": { + "name": "public_datasets_project_id_fkey", + "tableFrom": "datasets", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.evaluation_results": { + "name": "evaluation_results", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "target": { + "name": "target", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "executor_output": { + "name": "executor_output", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "index_in_batch": { + "name": "index_in_batch", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "trace_id": { + "name": "trace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "index": { + "name": "index", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "evaluation_results_evaluation_id_idx": { + "name": "evaluation_results_evaluation_id_idx", + "columns": [ + { + "expression": "evaluation_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "evaluation_results_evaluation_id_fkey1": { + "name": "evaluation_results_evaluation_id_fkey1", + "tableFrom": "evaluation_results", + "tableTo": "evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": { + "select_by_next_api_key": { + "name": "select_by_next_api_key", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "anon", + "authenticated" + ], + "using": "is_evaluation_id_accessible_for_api_key(api_key(), evaluation_id)" + } + }, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.evaluation_scores": { + "name": "evaluation_scores", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result_id": { + "name": "result_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "score": { + "name": "score", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "label_id": { + "name": "label_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "evaluation_scores_result_id_idx": { + "name": "evaluation_scores_result_id_idx", + "columns": [ + { + "expression": "result_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hash", + "with": {} + } + }, + "foreignKeys": { + "evaluation_scores_result_id_fkey": { + "name": "evaluation_scores_result_id_fkey", + "tableFrom": "evaluation_scores", + "tableTo": "evaluation_results", + "columnsFrom": [ + "result_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "evaluation_results_names_unique": { + "name": "evaluation_results_names_unique", + "nullsNotDistinct": false, + "columns": [ + "result_id", + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.evaluations": { + "name": "evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'default'" + } + }, + "indexes": { + "evaluations_project_id_hash_idx": { + "name": "evaluations_project_id_hash_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hash", + "with": {} + } + }, + "foreignKeys": { + "evaluations_project_id_fkey1": { + "name": "evaluations_project_id_fkey1", + "tableFrom": "evaluations", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": { + "select_by_next_api_key": { + "name": "select_by_next_api_key", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "anon", + "authenticated" + ], + "using": "is_evaluation_id_accessible_for_api_key(api_key(), id)" + } + }, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.events": { + "name": "events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes": { + "name": "attributes", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "span_id": { + "name": "span_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "events_span_id_project_id_idx": { + "name": "events_span_id_project_id_idx", + "columns": [ + { + "expression": "span_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "events_span_id_project_id_fkey": { + "name": "events_span_id_project_id_fkey", + "tableFrom": "events", + "tableTo": "spans", + "columnsFrom": [ + "span_id", + "project_id" + ], + "columnsTo": [ + "span_id", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.label_classes": { + "name": "label_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "value_map": { + "name": "value_map", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[false,true]'::jsonb" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "evaluator_runnable_graph": { + "name": "evaluator_runnable_graph", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "pipeline_version_id": { + "name": "pipeline_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "label_classes_project_id_fkey": { + "name": "label_classes_project_id_fkey", + "tableFrom": "label_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.label_classes_for_path": { + "name": "label_classes_for_path", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label_class_id": { + "name": "label_class_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "autoeval_labels_project_id_fkey": { + "name": "autoeval_labels_project_id_fkey", + "tableFrom": "label_classes_for_path", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_project_id_path_label_class": { + "name": "unique_project_id_path_label_class", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "path", + "label_class_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.labeling_queue_items": { + "name": "labeling_queue_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "queue_id": { + "name": "queue_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "action": { + "name": "action", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "span_id": { + "name": "span_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "labelling_queue_items_queue_id_fkey": { + "name": "labelling_queue_items_queue_id_fkey", + "tableFrom": "labeling_queue_items", + "tableTo": "labeling_queues", + "columnsFrom": [ + "queue_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.labeling_queues": { + "name": "labeling_queues", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "labeling_queues_project_id_fkey": { + "name": "labeling_queues_project_id_fkey", + "tableFrom": "labeling_queues", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.labels": { + "name": "labels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "class_id": { + "name": "class_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "span_id": { + "name": "span_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false, + "default": "gen_random_uuid()" + }, + "label_source": { + "name": "label_source", + "type": "label_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'MANUAL'" + }, + "reasoning": { + "name": "reasoning", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "trace_tags_type_id_fkey": { + "name": "trace_tags_type_id_fkey", + "tableFrom": "labels", + "tableTo": "label_classes", + "columnsFrom": [ + "class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "labels_span_id_class_id_user_id_key": { + "name": "labels_span_id_class_id_user_id_key", + "nullsNotDistinct": false, + "columns": [ + "class_id", + "span_id", + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.llm_prices": { + "name": "llm_prices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "input_price_per_million": { + "name": "input_price_per_million", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "output_price_per_million": { + "name": "output_price_per_million", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "input_cached_price_per_million": { + "name": "input_cached_price_per_million", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "additional_prices": { + "name": "additional_prices", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.machines": { + "name": "machines", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "machines_project_id_fkey": { + "name": "machines_project_id_fkey", + "tableFrom": "machines", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "machines_pkey": { + "name": "machines_pkey", + "columns": [ + "id", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.members_of_workspaces": { + "name": "members_of_workspaces", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "member_role": { + "name": "member_role", + "type": "workspace_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'owner'" + } + }, + "indexes": { + "members_of_workspaces_user_id_idx": { + "name": "members_of_workspaces_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "members_of_workspaces_user_id_fkey": { + "name": "members_of_workspaces_user_id_fkey", + "tableFrom": "members_of_workspaces", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "public_members_of_workspaces_workspace_id_fkey": { + "name": "public_members_of_workspaces_workspace_id_fkey", + "tableFrom": "members_of_workspaces", + "tableTo": "workspaces", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "members_of_workspaces_user_workspace_unique": { + "name": "members_of_workspaces_user_workspace_unique", + "nullsNotDistinct": false, + "columns": [ + "workspace_id", + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pipeline_templates": { + "name": "pipeline_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "runnable_graph": { + "name": "runnable_graph", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "displayable_graph": { + "name": "displayable_graph", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "number_of_nodes": { + "name": "number_of_nodes", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "display_group": { + "name": "display_group", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'build'" + }, + "ordinal": { + "name": "ordinal", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 500 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pipeline_versions": { + "name": "pipeline_versions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "pipeline_id": { + "name": "pipeline_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "displayable_graph": { + "name": "displayable_graph", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "runnable_graph": { + "name": "runnable_graph", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "pipeline_type": { + "name": "pipeline_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": { + "all_actions_by_next_api_key": { + "name": "all_actions_by_next_api_key", + "as": "PERMISSIVE", + "for": "ALL", + "to": [ + "anon", + "authenticated" + ], + "using": "is_pipeline_id_accessible_for_api_key(api_key(), pipeline_id)" + } + }, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pipelines": { + "name": "pipelines", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PRIVATE'" + }, + "python_requirements": { + "name": "python_requirements", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "pipelines_name_project_id_idx": { + "name": "pipelines_name_project_id_idx", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "text_ops" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pipelines_project_id_idx": { + "name": "pipelines_project_id_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pipelines_project_id_fkey": { + "name": "pipelines_project_id_fkey", + "tableFrom": "pipelines", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_project_id_pipeline_name": { + "name": "unique_project_id_pipeline_name", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.playgrounds": { + "name": "playgrounds", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "prompt_messages": { + "name": "prompt_messages", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[{\"role\":\"user\",\"content\":\"\"}]'::jsonb" + }, + "model_id": { + "name": "model_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "output_schema": { + "name": "output_schema", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "playgrounds_project_id_fkey": { + "name": "playgrounds_project_id_fkey", + "tableFrom": "playgrounds", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_api_keys": { + "name": "project_api_keys", + "schema": "", + "columns": { + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shorthand": { + "name": "shorthand", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + } + }, + "indexes": { + "project_api_keys_hash_idx": { + "name": "project_api_keys_hash_idx", + "columns": [ + { + "expression": "hash", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "text_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hash", + "with": {} + } + }, + "foreignKeys": { + "public_project_api_keys_project_id_fkey": { + "name": "public_project_api_keys_project_id_fkey", + "tableFrom": "project_api_keys", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "projects_workspace_id_idx": { + "name": "projects_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "projects_workspace_id_fkey": { + "name": "projects_workspace_id_fkey", + "tableFrom": "projects", + "tableTo": "workspaces", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.provider_api_keys": { + "name": "provider_api_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "nonce_hex": { + "name": "nonce_hex", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "provider_api_keys_project_id_fkey": { + "name": "provider_api_keys_project_id_fkey", + "tableFrom": "provider_api_keys", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.render_templates": { + "name": "render_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "render_templates_project_id_fkey": { + "name": "render_templates_project_id_fkey", + "tableFrom": "render_templates", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.spans": { + "name": "spans", + "schema": "", + "columns": { + "span_id": { + "name": "span_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "parent_span_id": { + "name": "parent_span_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes": { + "name": "attributes", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "input": { + "name": "input", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "output": { + "name": "output", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "span_type": { + "name": "span_type", + "type": "span_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "trace_id": { + "name": "trace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "input_preview": { + "name": "input_preview", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "output_preview": { + "name": "output_preview", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "input_url": { + "name": "input_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "output_url": { + "name": "output_url", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "span_path_idx": { + "name": "span_path_idx", + "columns": [ + { + "expression": "(attributes -> 'lmnr.span.path'::text)", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "spans_project_id_idx": { + "name": "spans_project_id_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hash", + "with": {} + }, + "spans_project_id_trace_id_start_time_idx": { + "name": "spans_project_id_trace_id_start_time_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "trace_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + }, + { + "expression": "start_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "spans_root_project_id_start_time_end_time_trace_id_idx": { + "name": "spans_root_project_id_start_time_end_time_trace_id_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + }, + { + "expression": "start_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "end_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "trace_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "where": "(parent_span_id IS NULL)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "spans_start_time_end_time_idx": { + "name": "spans_start_time_end_time_idx", + "columns": [ + { + "expression": "start_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "end_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "spans_trace_id_idx": { + "name": "spans_trace_id_idx", + "columns": [ + { + "expression": "trace_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "spans_trace_id_start_time_idx": { + "name": "spans_trace_id_start_time_idx", + "columns": [ + { + "expression": "trace_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + }, + { + "expression": "start_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "spans_project_id_fkey": { + "name": "spans_project_id_fkey", + "tableFrom": "spans", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "spans_pkey": { + "name": "spans_pkey", + "columns": [ + "span_id", + "project_id" + ] + } + }, + "uniqueConstraints": { + "unique_span_id_project_id": { + "name": "unique_span_id_project_id", + "nullsNotDistinct": false, + "columns": [ + "span_id", + "project_id" + ] + } + }, + "policies": { + "select_by_next_api_key": { + "name": "select_by_next_api_key", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ], + "using": "is_project_id_accessible_for_api_key(api_key(), project_id)" + } + }, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.subscription_tiers": { + "name": "subscription_tiers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "subscription_tiers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854776000", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_mib": { + "name": "storage_mib", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "log_retention_days": { + "name": "log_retention_days", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "members_per_workspace": { + "name": "members_per_workspace", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'-1'" + }, + "num_workspaces": { + "name": "num_workspaces", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'-1'" + }, + "stripe_product_id": { + "name": "stripe_product_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "events": { + "name": "events", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "spans": { + "name": "spans", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "extra_span_price": { + "name": "extra_span_price", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "extra_event_price": { + "name": "extra_event_price", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": "'0'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.target_pipeline_versions": { + "name": "target_pipeline_versions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "pipeline_id": { + "name": "pipeline_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "pipeline_version_id": { + "name": "pipeline_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "target_pipeline_versions_pipeline_id_fkey": { + "name": "target_pipeline_versions_pipeline_id_fkey", + "tableFrom": "target_pipeline_versions", + "tableTo": "pipelines", + "columnsFrom": [ + "pipeline_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "target_pipeline_versions_pipeline_version_id_fkey": { + "name": "target_pipeline_versions_pipeline_version_id_fkey", + "tableFrom": "target_pipeline_versions", + "tableTo": "pipeline_versions", + "columnsFrom": [ + "pipeline_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_pipeline_id": { + "name": "unique_pipeline_id", + "nullsNotDistinct": false, + "columns": [ + "pipeline_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.traces": { + "name": "traces", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "start_time": { + "name": "start_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "total_token_count": { + "name": "total_token_count", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "cost": { + "name": "cost", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "trace_type": { + "name": "trace_type", + "type": "trace_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'DEFAULT'" + }, + "input_token_count": { + "name": "input_token_count", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "output_token_count": { + "name": "output_token_count", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "input_cost": { + "name": "input_cost", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "output_cost": { + "name": "output_cost", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "has_browser_session": { + "name": "has_browser_session", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "top_span_id": { + "name": "top_span_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "trace_metadata_gin_idx": { + "name": "trace_metadata_gin_idx", + "columns": [ + { + "expression": "metadata", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "jsonb_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "traces_id_project_id_start_time_times_not_null_idx": { + "name": "traces_id_project_id_start_time_times_not_null_idx", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "start_time", + "isExpression": false, + "asc": false, + "nulls": "first", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "where": "((start_time IS NOT NULL) AND (end_time IS NOT NULL))", + "concurrently": false, + "method": "btree", + "with": {} + }, + "traces_project_id_idx": { + "name": "traces_project_id_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "uuid_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "traces_project_id_trace_type_start_time_end_time_idx": { + "name": "traces_project_id_trace_type_start_time_end_time_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "start_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "end_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + } + ], + "isUnique": false, + "where": "((trace_type = 'DEFAULT'::trace_type) AND (start_time IS NOT NULL) AND (end_time IS NOT NULL))", + "concurrently": false, + "method": "btree", + "with": {} + }, + "traces_session_id_idx": { + "name": "traces_session_id_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "text_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "traces_start_time_end_time_idx": { + "name": "traces_start_time_end_time_idx", + "columns": [ + { + "expression": "start_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + }, + { + "expression": "end_time", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "timestamptz_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "new_traces_project_id_fkey": { + "name": "new_traces_project_id_fkey", + "tableFrom": "traces", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": { + "select_by_next_api_key": { + "name": "select_by_next_api_key", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "anon", + "authenticated" + ], + "using": "is_project_id_accessible_for_api_key(api_key(), project_id)" + } + }, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_subscription_info": { + "name": "user_subscription_info", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "activated": { + "name": "activated", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "user_subscription_info_stripe_customer_id_idx": { + "name": "user_subscription_info_stripe_customer_id_idx", + "columns": [ + { + "expression": "stripe_customer_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "text_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_subscription_info_fkey": { + "name": "user_subscription_info_fkey", + "tableFrom": "user_subscription_info", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_key": { + "name": "users_email_key", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": { + "Enable insert for authenticated users only": { + "name": "Enable insert for authenticated users only", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "service_role" + ], + "withCheck": "true" + } + }, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_usage": { + "name": "workspace_usage", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "span_count": { + "name": "span_count", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "span_count_since_reset": { + "name": "span_count_since_reset", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "prev_span_count": { + "name": "prev_span_count", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "event_count": { + "name": "event_count", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "event_count_since_reset": { + "name": "event_count_since_reset", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "prev_event_count": { + "name": "prev_event_count", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "reset_time": { + "name": "reset_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "reset_reason": { + "name": "reset_reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'signup'" + } + }, + "indexes": {}, + "foreignKeys": { + "user_usage_workspace_id_fkey": { + "name": "user_usage_workspace_id_fkey", + "tableFrom": "workspace_usage", + "tableTo": "workspaces", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_usage_workspace_id_key": { + "name": "user_usage_workspace_id_key", + "nullsNotDistinct": false, + "columns": [ + "workspace_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspaces": { + "name": "workspaces", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tier_id": { + "name": "tier_id", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'1'" + }, + "subscription_id": { + "name": "subscription_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "additional_seats": { + "name": "additional_seats", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "'0'" + } + }, + "indexes": {}, + "foreignKeys": { + "workspaces_tier_id_fkey": { + "name": "workspaces_tier_id_fkey", + "tableFrom": "workspaces", + "tableTo": "subscription_tiers", + "columnsFrom": [ + "tier_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.label_source": { + "name": "label_source", + "schema": "public", + "values": [ + "MANUAL", + "AUTO", + "CODE" + ] + }, + "public.span_type": { + "name": "span_type", + "schema": "public", + "values": [ + "DEFAULT", + "LLM", + "PIPELINE", + "EXECUTOR", + "EVALUATOR", + "EVALUATION", + "TOOL" + ] + }, + "public.trace_type": { + "name": "trace_type", + "schema": "public", + "values": [ + "DEFAULT", + "EVENT", + "EVALUATION" + ] + }, + "public.workspace_role": { + "name": "workspace_role", + "schema": "public", + "values": [ + "member", + "owner" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/frontend/lib/db/migrations/meta/_journal.json b/frontend/lib/db/migrations/meta/_journal.json index 60ee0251..529d5640 100644 --- a/frontend/lib/db/migrations/meta/_journal.json +++ b/frontend/lib/db/migrations/meta/_journal.json @@ -155,6 +155,13 @@ "when": 1740411117034, "tag": "0021_cold_morbius", "breakpoints": true + }, + { + "idx": 22, + "version": "7", + "when": 1740465455805, + "tag": "0022_hesitant_skin", + "breakpoints": true } ] } \ No newline at end of file diff --git a/frontend/lib/db/migrations/schema.ts b/frontend/lib/db/migrations/schema.ts index 63f74bc9..7ba07e15 100644 --- a/frontend/lib/db/migrations/schema.ts +++ b/frontend/lib/db/migrations/schema.ts @@ -275,6 +275,7 @@ export const traces = pgTable("traces", { inputCost: doublePrecision("input_cost").default(sql`'0'`).notNull(), outputCost: doublePrecision("output_cost").default(sql`'0'`).notNull(), hasBrowserSession: boolean("has_browser_session"), + topSpanId: uuid("top_span_id"), }, (table) => [ index("trace_metadata_gin_idx").using("gin", table.metadata.asc().nullsLast().op("jsonb_ops")), index("traces_id_project_id_start_time_times_not_null_idx").using("btree", table.id.asc().nullsLast().op("timestamptz_ops"), table.projectId.asc().nullsLast().op("timestamptz_ops"), table.startTime.desc().nullsFirst().op("uuid_ops")).where(sql`((start_time IS NOT NULL) AND (end_time IS NOT NULL))`), diff --git a/frontend/lib/traces/types.ts b/frontend/lib/traces/types.ts index d881fd73..0f32a508 100644 --- a/frontend/lib/traces/types.ts +++ b/frontend/lib/traces/types.ts @@ -99,6 +99,7 @@ export type Trace = { outputCost: number | null; cost: number | null; metadata: Record | null; + topSpanId: string | null; topSpanInputPreview: any | null; topSpanOutputPreview: any | null; topSpanName: string | null;