From 1ed525e0947c236111d0470f9a06edc8a572bd78 Mon Sep 17 00:00:00 2001 From: kenvora Date: Thu, 6 Aug 2026 10:44:05 -0700 Subject: [PATCH 1/3] fix: remove org/workspace names from PG export queries --- .../postgres/pg_usage_agent_builder_full_export.sql | 6 +----- .../postgres/pg_usage_nodes_backfill_export.sql | 3 --- .../postgres/pg_usage_nodes_backfill_update.sql | 6 +----- .../support_queries/postgres/pg_usage_nodes_full_export.sql | 5 +---- .../postgres/pg_usage_traces_backfill_export.sql | 4 ---- .../postgres/pg_usage_traces_backfill_update.sql | 6 +----- .../postgres/pg_usage_traces_full_export.sql | 6 +----- 7 files changed, 5 insertions(+), 31 deletions(-) diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_agent_builder_full_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_agent_builder_full_export.sql index d33b9f35..0db4e70a 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_agent_builder_full_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_agent_builder_full_export.sql @@ -1,10 +1,6 @@ -- This query exports all agent builder usage. SELECT - abu.*, - t.display_name AS workspace_name, - o.display_name AS organization_name + abu.* FROM agent_builder_usage abu -JOIN tenants t ON abu.tenant_id = t.id -JOIN organizations o ON t.organization_id = o.id ORDER BY abu.from_timestamp DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql index 6da22e37..897f823d 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql @@ -31,11 +31,8 @@ backfill_txns AS ( SELECT bt.*, t.organization_id, - t.display_name AS workspace_name, - o.display_name AS organization_name, :'customer_id' AS customer_id, :'customer_name' AS customer_name FROM backfill_txns bt JOIN tenants t ON bt.tenant_id = t.id -JOIN organizations o ON o.id = t.organization_id ORDER BY bt.received_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_update.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_update.sql index b4090ab1..bcfbd4b0 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_update.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_update.sql @@ -22,10 +22,6 @@ WITH backfilled_txns AS ( backfilled_at ) SELECT - bt.*, - t.display_name AS workspace_name, - o.display_name AS organization_name + bt.* FROM backfilled_txns bt -JOIN tenants t ON bt.tenant_id = t.id -JOIN organizations o ON o.id = t.organization_id ORDER BY bt.received_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql index a6d6c89e..02ecb81c 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql @@ -14,10 +14,7 @@ SELECT rm.self_hosted_customer_id, rm.backfill_id, rm.backfilled_at, - t.organization_id, - t.display_name AS workspace_name, - o.display_name AS organization_name + t.organization_id FROM remote_metrics rm JOIN tenants t ON rm.tenant_id = t.id -JOIN organizations o ON t.organization_id = o.id ORDER BY rm.received_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_export.sql index 25dd1b3a..9e01a88d 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_export.sql @@ -18,11 +18,7 @@ backfill_txns AS ( ) SELECT bt.*, - t.display_name AS workspace_name, - o.display_name AS organization_name, :'customer_id' AS customer_id, :'customer_name' AS customer_name FROM backfill_txns bt -JOIN tenants t ON bt.tenant_id = t.id -JOIN organizations o ON bt.organization_id = o.id ORDER BY bt.created_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_update.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_update.sql index a4564dc2..c5f3bd5d 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_update.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_backfill_update.sql @@ -9,10 +9,6 @@ WITH backfilled_txns AS ( RETURNING * ) SELECT - bt.*, - t.display_name AS workspace_name, - o.display_name AS organization_name + bt.* FROM backfilled_txns bt -JOIN tenants t ON bt.tenant_id = t.id -JOIN organizations o ON bt.organization_id = o.id ORDER BY bt.created_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_full_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_full_export.sql index fdb8a019..ce4e73b1 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_full_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_traces_full_export.sql @@ -1,10 +1,6 @@ -- This query exports all trace count transactions. SELECT - tc.*, - t.display_name AS workspace_name, - o.display_name AS organization_name + tc.* FROM trace_count_transactions tc -JOIN tenants t ON tc.tenant_id = t.id -JOIN organizations o ON t.organization_id = o.id ORDER BY tc.created_at DESC; From 3ee14ba97a34dd9e46353b26cc9ead2e6bce20e2 Mon Sep 17 00:00:00 2001 From: kenvora Date: Thu, 6 Aug 2026 11:14:27 -0700 Subject: [PATCH 2/3] updates --- .../support_queries/postgres/pg_usage_nodes_backfill_export.sql | 2 +- .../support_queries/postgres/pg_usage_nodes_full_export.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql index 897f823d..c7baf7e0 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_backfill_export.sql @@ -34,5 +34,5 @@ SELECT :'customer_id' AS customer_id, :'customer_name' AS customer_name FROM backfill_txns bt -JOIN tenants t ON bt.tenant_id = t.id +LEFT JOIN tenants t ON bt.tenant_id = t.id ORDER BY bt.received_at DESC; diff --git a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql index 02ecb81c..bf19e765 100644 --- a/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql +++ b/charts/langsmith/scripts/support_queries/postgres/pg_usage_nodes_full_export.sql @@ -16,5 +16,5 @@ SELECT rm.backfilled_at, t.organization_id FROM remote_metrics rm -JOIN tenants t ON rm.tenant_id = t.id +LEFT JOIN tenants t ON rm.tenant_id = t.id ORDER BY rm.received_at DESC; From 15fd178f9ac3f5a499a607579ce82723d6476261 Mon Sep 17 00:00:00 2001 From: kenvora Date: Thu, 6 Aug 2026 16:48:30 -0700 Subject: [PATCH 3/3] trigger build