: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(logs): poll drop-rule impact every 30s so the table stays in sync (#59553)
Daniel Viscab37bf75b41ba
diff --git a/products/logs/frontend/components/LogsSampling/logsSamplingSectionLogic.ts b/products/logs/frontend/components/LogsSampling/logsSamplingSectionLogic.tsindex 3567a89d379e..d7e8163bbd68 100644--- a/products/logs/frontend/components/LogsSampling/logsSamplingSectionLogic.ts+++ b/products/logs/frontend/components/LogsSampling/logsSamplingSectionLogic.ts@@ -15,6 +15,12 @@ import { LogsSamplingRuleApi } from 'products/logs/frontend/generated/api.schemaimport type { logsSamplingSectionLogicType } from './logsSamplingSectionLogicType'import { fetchSamplingRuleDropTotalsLast24h } from './samplingRuleDropImpact'+// Background refresh cadence for the per-rule 24h drop counts. The underlying+// `app_metrics2` table flushes every ~1 min, so a 30s tick is fast enough that+// the user sees the new numbers shortly after they arrive without spamming+// HogQL. The disposables plugin pauses the timer while the tab is hidden.+const IMPACT_POLL_INTERVAL_MS = 30_000+export const logsSamplingSectionLogic = kea<logsSamplingSectionLogicType>([path(['products', 'logs', 'frontend', 'components', 'LogsSampling', 'logsSamplingSectionLogic']),@@ -155,7 +161,13 @@ export const logsSamplingSectionLogic = kea<logsSamplingSectionLogicType>([},})),- afterMount(({ actions }) => {+ afterMount(({ actions, cache }) => {actions.loadRules()+ cache.disposables.add(() => {+ const pollTimer = window.setInterval(() => {+ actions.loadRuleDropImpact(undefined)+ }, IMPACT_POLL_INTERVAL_MS)+ return () => clearInterval(pollTimer)+ }, 'impactPoller')}),])