:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(llma): keep clusters page populated past the 7-day read window (#62867)
posthog[bot]f38d9f6e039a
diff --git a/products/ai_observability/frontend/clusters/clustersLogic.ts b/products/ai_observability/frontend/clusters/clustersLogic.tsindex 51f54456dd6f..5599db318f54 100644--- a/products/ai_observability/frontend/clusters/clustersLogic.ts+++ b/products/ai_observability/frontend/clusters/clustersLogic.ts@@ -20,6 +20,7 @@ import type { clustersLogicType } from './clustersLogicType'import {FILTER_QUERY_MAX_ROWS,AI_OBSERVABILITY_CLUSTERS_SCENE_TAG,+ CLUSTERING_RUNS_LOOKBACK_DAYS,MAX_CLUSTERING_RUNS,NOISE_CLUSTER_ID,OUTLIER_COLOR,@@ -319,6 +320,10 @@ export const clustersLogic = kea<clustersLogicType>([loadClusteringRuns: async () => {const eventName = eventNameForLevel(values.clusteringLevel)+ // Look back a wide window rather than a hard 7 days: scheduled runs are+ // emitted ~daily but a team can go several days without a fresh one, and a+ // narrow window made the page go empty the moment the last run aged out.+ // MAX_CLUSTERING_RUNS still bounds the result.const response = await api.queryHogQL(hogql`SELECT@@ -327,7 +332,7 @@ export const clustersLogic = kea<clustersLogicType>([timestampFROM eventsWHERE event = ${eventName}- AND timestamp >= now() - INTERVAL 7 DAY+ AND timestamp >= now() - INTERVAL ${hogql.raw(String(CLUSTERING_RUNS_LOOKBACK_DAYS))} DAYORDER BY timestamp DESCLIMIT ${MAX_CLUSTERING_RUNS}`,diff --git a/products/ai_observability/frontend/clusters/constants.ts b/products/ai_observability/frontend/clusters/constants.tsindex 8fac2ee92bdc..ae4534aba50f 100644--- a/products/ai_observability/frontend/clusters/constants.ts+++ b/products/ai_observability/frontend/clusters/constants.ts@@ -10,6 +10,12 @@ export const TRACES_PER_PAGE = 50// Query limitsexport const MAX_CLUSTERING_RUNS = 20+// How far back to look for clustering runs. Scheduled runs are emitted (roughly) daily, but+// a team can go several days without a fresh run — low-traffic days, sampling, or a paused+// schedule. A wide window keeps the most recent run visible instead of the page going empty+// the moment the last run ages past a day or two. MAX_CLUSTERING_RUNS still bounds the result.+export const CLUSTERING_RUNS_LOOKBACK_DAYS = 90+// Cluster detail URL pattern. Mirrored in `manifest.tsx`'s route registration so any// `urlToAction` matcher (e.g. `clusterDetailLogic`, `aiObservabilitySharedLogic`)// stays in lockstep with the actual route.diff --git a/products/ai_observability/frontend/components/clustersTabContentLogic.ts b/products/ai_observability/frontend/components/clustersTabContentLogic.tsindex 4d55b7e110f3..6cbd0efc6ba7 100644--- a/products/ai_observability/frontend/components/clustersTabContentLogic.ts+++ b/products/ai_observability/frontend/components/clustersTabContentLogic.ts@@ -6,7 +6,7 @@ import api from 'lib/api'import { hogql } from '~/queries/utils'-import { NOISE_CLUSTER_ID } from '../clusters/constants'+import { CLUSTERING_RUNS_LOOKBACK_DAYS, NOISE_CLUSTER_ID } from '../clusters/constants'import { Cluster } from '../clusters/types'import type { clustersTabContentLogicType } from './clustersTabContentLogicType'@@ -45,7 +45,7 @@ export const clustersTabContentLogic = kea<clustersTabContentLogicType>([timestampFROM eventsWHERE event = '$ai_trace_clusters'- AND timestamp >= now() - INTERVAL 7 DAY+ AND timestamp >= now() - INTERVAL ${hogql.raw(String(CLUSTERING_RUNS_LOOKBACK_DAYS))} DAYORDER BY timestamp DESCLIMIT 20`,