Skip to content

: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.

chore(alerts): remove rolled-out quiet hours and history chart flags (#59426)

Matt Pua9582747668a1
diff --git a/frontend/src/lib/components/Alerts/alertFormLogic.test.ts b/frontend/src/lib/components/Alerts/alertFormLogic.test.ts
index 4902fb92833a..78916777542b 100644
--- a/frontend/src/lib/components/Alerts/alertFormLogic.test.ts
+++ b/frontend/src/lib/components/Alerts/alertFormLogic.test.ts
@@ -136,7 +136,6 @@ describe('alertFormLogic', () => {
onEditSuccess,
insightVizDataLogicProps: insightLogicProps,
insightInterval: 'day',
- historyChartEnabled: false,
})
logic.mount()
logic.actions.setAlertFormValues({ ...makeFormDefaults(), checks: undefined })
@@ -217,7 +216,6 @@ describe('alertFormLogic', () => {
onEditSuccess,
insightVizDataLogicProps: insightLogicProps,
insightInterval: 'day',
- historyChartEnabled: false,
})
logic.mount()
logic.actions.setAlertFormValues({ ...makeFormDefaults({ id: existingAlert.id }), checks: undefined })
diff --git a/frontend/src/lib/components/Alerts/alertFormLogic.ts b/frontend/src/lib/components/Alerts/alertFormLogic.ts
index 019db1eb7739..8df48b10f025 100644
--- a/frontend/src/lib/components/Alerts/alertFormLogic.ts
+++ b/frontend/src/lib/components/Alerts/alertFormLogic.ts
@@ -77,8 +77,6 @@ export interface AlertFormLogicProps {
onEditSuccess: (alertId?: AlertType['id']) => void
insightVizDataLogicProps?: InsightLogicProps
insightInterval?: IntervalType
- /** Must match the `alertLogic` instance keyed on the same alertId — read from `useFeatureFlag('ALERTS_HISTORY_CHART')` in the parent. */
- historyChartEnabled: boolean
}
/**
@@ -90,8 +88,8 @@ export interface AlertFormLogicProps {
* `logic.values` on an unmounted logic throws a `[KEA] Can not find path …` error. Check mount state
* first and skip the merge (there's nothing to preserve for a brand-new alert).
*/
-function hydrateAlertLogicFromSaveResponse(updatedAlert: AlertType, historyChartEnabled: boolean): void {
- const logic = alertLogic({ alertId: updatedAlert.id, historyChartEnabled })
+function hydrateAlertLogicFromSaveResponse(updatedAlert: AlertType): void {
+ const logic = alertLogic({ alertId: updatedAlert.id })
const wasMounted = logic.isMounted()
const previousAlert = wasMounted ? logic.values.alert : null
const savedChecks = updatedAlert.checks ?? []
@@ -315,7 +313,7 @@ export const alertFormLogic = kea<alertFormLogicType>([
// as "Error saving alert" since the API returned 2xx. Regression guarded by `alertFormLogic.test.ts`.
try {
await flushPendingNotifications(updatedAlert.id)
- hydrateAlertLogicFromSaveResponse(updatedAlert, props.historyChartEnabled)
+ hydrateAlertLogicFromSaveResponse(updatedAlert)
upsertToParent(updatedAlert)
props.onEditSuccess(updatedAlert.id)
} catch (postSaveError) {
@@ -364,7 +362,7 @@ export const alertFormLogic = kea<alertFormLogicType>([
const updatedAlert: AlertType = await api.alerts.update(values.alertForm.id, {
snoozed_until: snoozeUntil,
})
- hydrateAlertLogicFromSaveResponse(updatedAlert, props.historyChartEnabled)
+ hydrateAlertLogicFromSaveResponse(updatedAlert)
const parent = getParentLogic()
if (parent) {
parent.actions.upsertAlert(updatedAlert)
@@ -379,7 +377,7 @@ export const alertFormLogic = kea<alertFormLogicType>([
const updatedAlert: AlertType = await api.alerts.update(values.alertForm.id, {
snoozed_until: null,
})
- hydrateAlertLogicFromSaveResponse(updatedAlert, props.historyChartEnabled)
+ hydrateAlertLogicFromSaveResponse(updatedAlert)
const parent = getParentLogic()
if (parent) {
parent.actions.upsertAlert(updatedAlert)
diff --git a/frontend/src/lib/components/Alerts/alertLogic.ts b/frontend/src/lib/components/Alerts/alertLogic.ts
index 2fa3bfd6e3d2..246b2826517e 100644
--- a/frontend/src/lib/components/Alerts/alertLogic.ts
+++ b/frontend/src/lib/components/Alerts/alertLogic.ts
@@ -1,4 +1,4 @@
-import { actions, events, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import { actions, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -35,13 +35,11 @@ export interface AlertHistoryChartPoint {
export interface AlertLogicProps {
alertId?: AlertType['id'] | null
- /** `FEATURE_FLAGS.ALERTS_HISTORY_CHART` — drives default checks fetch window; keep in sync wherever `alertLogic` is built. */
- historyChartEnabled: boolean
}
-function initialChecksHistoryParams(historyChartEnabled: boolean | undefined): ChecksHistoryParams {
+function initialChecksHistoryParams(): ChecksHistoryParams {
return {
- limit: historyChartEnabled ? CHART_CHECKS_LIMIT : TABLE_CHECKS_PAGE_SIZE,
+ limit: CHART_CHECKS_LIMIT,
offset: 0,
}
}
@@ -65,7 +63,6 @@ export const alertLogic = kea<alertLogicType>([
path(['lib', 'components', 'Alerts', 'alertLogic']),
props({
alertId: null,
- historyChartEnabled: false,
} as AlertLogicProps),
key(({ alertId }) => alertId ?? 'new'),
@@ -81,15 +78,15 @@ export const alertLogic = kea<alertLogicType>([
alertHistoryTablePageBackward: true,
}),
- reducers(({ props }) => ({
+ reducers(() => ({
checksHistoryParams: [
- initialChecksHistoryParams(props.historyChartEnabled),
+ initialChecksHistoryParams(),
{
setChecksHistoryParams: (_, { limit, offset }) => ({ limit, offset }),
},
],
alertHistoryView: [
- (props.historyChartEnabled ? 'chart' : 'table') as 'chart' | 'table',
+ 'chart' as 'chart' | 'table',
{
setAlertHistoryView: (_, { view }) => view,
},
@@ -119,21 +116,6 @@ export const alertLogic = kea<alertLogicType>([
],
})),
- propsChanged(({ actions, props }, oldProps) => {
- if (!oldProps) {
- return
- }
- const next = !!props.historyChartEnabled
- const prev = !!oldProps.historyChartEnabled
- if (next === prev) {
- return
- }
- actions.setAlertHistoryView(next ? 'chart' : 'table')
- actions.setChecksHistoryTablePage(1)
- actions.setChecksHistoryParams(next ? CHART_CHECKS_LIMIT : TABLE_CHECKS_PAGE_SIZE, 0)
- actions.loadAlert()
- }),
-
// Selector deps must be functions from `logic.selectors` / propSelectors — not raw state values.
selectors(() => ({
alertHistoryIsAnomalyDetection: [(s) => [s.alert], (alert: AlertType | null) => !!alert?.detector_config],
@@ -145,9 +127,9 @@ export const alertLogic = kea<alertLogicType>([
},
],
alertHistoryChartSeries: [
- (s, p) => [p.historyChartEnabled, s.alert],
- (historyChartEnabled: boolean, alert: AlertType | null): AlertHistoryChartPoint[] => {
- if (!historyChartEnabled || !alert) {
+ (s) => [s.alert],
+ (alert: AlertType | null): AlertHistoryChartPoint[] => {
+ if (!alert) {
return []
}
const isAnomaly = !!alert.detector_config
@@ -170,9 +152,9 @@ export const alertLogic = kea<alertLogicType>([
},
],
alertHistoryUsesAnomalyScores: [
- (s, p) => [p.historyChartEnabled, s.alert],
- (historyChartEnabled: boolean, alert: AlertType | null): boolean => {
- if (!historyChartEnabled || !alert?.detector_config) {
+ (s) => [s.alert],
+ (alert: AlertType | null): boolean => {
+ if (!alert?.detector_config) {
return false
}
const checks = alert.checks ?? []
@@ -198,9 +180,8 @@ export const alertLogic = kea<alertLogicType>([
},
],
alertHistoryHasChartableHistory: [
- (s, p) => [s.alertHistoryChartSeries, p.historyChartEnabled],
- (series: AlertHistoryChartPoint[], historyChartEnabled: boolean) =>
- !!historyChartEnabled && series.length > 0,
+ (s) => [s.alertHistoryChartSeries],
+ (series: AlertHistoryChartPoint[]) => series.length > 0,
],
alertHistoryTablePageCount: [
(s) => [s.alert],
@@ -220,11 +201,8 @@ export const alertLogic = kea<alertLogicType>([
],
})),
- listeners(({ actions, values, props }) => ({
+ listeners(({ actions, values }) => ({
selectAlertHistoryView: ({ view }) => {
- if (!props.historyChartEnabled) {
- return
- }
actions.setAlertHistoryView(view)
if (view === 'table') {
actions.setChecksHistoryTablePage(1)
diff --git a/frontend/src/lib/components/Alerts/views/AlertHistorySection.tsx b/frontend/src/lib/components/Alerts/views/AlertHistorySection.tsx
index 996c0610b233..ce03a86ae000 100644
--- a/frontend/src/lib/components/Alerts/views/AlertHistorySection.tsx
+++ b/frontend/src/lib/components/Alerts/views/AlertHistorySection.tsx
@@ -19,7 +19,6 @@ import { AlertStateIndicator } from 'lib/components/Alerts/views/ManageAlertsMod
import { EmptyMessage } from 'lib/components/EmptyMessage/EmptyMessage'
import { TZLabel } from 'lib/components/TZLabel'
import { dayjs } from 'lib/dayjs'
-import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconOpenInNew } from 'lib/lemon-ui/icons'
import { formatDate } from 'lib/utils'
@@ -106,28 +105,23 @@ function InvestigationCell({ check }: { check: AlertCheck }): JSX.Element {
}
/** Placeholder while alert detail (including check history) is loading; avoids an empty gap before `AlertHistorySection` mounts. */
-export function AlertHistorySectionSkeleton({ showChartArea = true }: { showChartArea?: boolean }): JSX.Element {
+export function AlertHistorySectionSkeleton(): JSX.Element {
return (
<div className="mt-10 space-y-2" aria-busy="true" aria-label="Loading alert history">
<div className="flex flex-row gap-2 items-center">
<LemonSkeleton className="h-4 w-36" />
<LemonSkeleton className="h-6 w-28" />
</div>
- {showChartArea ? <LemonSkeleton className="h-8 w-44" /> : null}
- {showChartArea ? (
- <LemonSkeleton className="h-56 w-full min-h-56" />
- ) : (
- <LemonSkeleton className="h-72 w-full min-h-72" />
- )}
- {showChartArea ? <LemonSkeleton className="h-3 w-full max-w-xl" /> : null}
+ <LemonSkeleton className="h-8 w-44" />
+ <LemonSkeleton className="h-56 w-full min-h-56" />
+ <LemonSkeleton className="h-3 w-full max-w-xl" />
</div>
)
}
-/** Check history in the alert modal: status, empty state, chart/table toggle (when enabled), and paginated table. */
+/** Check history in the alert modal: status, empty state, chart/table toggle, and paginated table. */
export function AlertHistorySection({ alertId }: { alertId: AlertType['id'] }): JSX.Element | null {
- const historyChartEnabled = useFeatureFlag('ALERTS_HISTORY_CHART')
- const logic = alertLogic({ alertId, historyChartEnabled })
+ const logic = alertLogic({ alertId })
const {
alert,
alertLoading,
@@ -230,7 +224,7 @@ export function AlertHistorySection({ alertId }: { alertId: AlertType['id'] }):
]}
/>
) : null}
- {historyChartEnabled && alertHistoryView === 'chart' && alertHistoryHasChartableHistory ? (
+ {alertHistoryView === 'chart' && alertHistoryHasChartableHistory ? (
<div className="relative">
{alertLoading ? <SpinnerOverlay /> : null}
<AlertHistoryChart
diff --git a/frontend/src/lib/components/Alerts/views/Alerts.tsx b/frontend/src/lib/components/Alerts/views/Alerts.tsx
index 3172dc5ddf6a..5ba851006485 100644
--- a/frontend/src/lib/components/Alerts/views/Alerts.tsx
+++ b/frontend/src/lib/components/Alerts/views/Alerts.tsx
@@ -6,11 +6,9 @@ import { LemonTag, Link, Tooltip } from '@posthog/lemon-ui'
import { DetectiveHog } from 'lib/components/hedgehogs'
import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'
import { TZLabel } from 'lib/components/TZLabel'
-import { FEATURE_FLAGS } from 'lib/constants'
import { LemonTable, LemonTableColumn, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
import { createdByColumn } from 'lib/lemon-ui/LemonTable/columnUtils'
import { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
@@ -32,9 +30,7 @@ export function Alerts({ alertId }: AlertsProps): JSX.Element {
const { loadAlerts } = useActions(logic)
const { alertsSortedByState, alertsLoading } = useValues(logic)
- const { featureFlags } = useValues(featureFlagLogic)
- const alertsHistoryChartEnabled = !!featureFlags[FEATURE_FLAGS.ALERTS_HISTORY_CHART]
- const { alert } = useValues(alertLogic({ alertId, historyChartEnabled: alertsHistoryChartEnabled }))
+ const { alert } = useValues(alertLogic({ alertId }))
const columns: LemonTableColumns<AlertType> = [
{
diff --git a/frontend/src/lib/components/Alerts/views/EditAlertModal.tsx b/frontend/src/lib/components/Alerts/views/EditAlertModal.tsx
index 5e0a7dae5996..cad26db3c68b 100644
--- a/frontend/src/lib/components/Alerts/views/EditAlertModal.tsx
+++ b/frontend/src/lib/components/Alerts/views/EditAlertModal.tsx
@@ -117,10 +117,9 @@ export function EditAlertModal({
onEditSuccess,
insightLogicProps,
}: EditAlertModalProps): JSX.Element {
- const alertsHistoryChartEnabled = useFeatureFlag('ALERTS_HISTORY_CHART')
const alerts15MinuteIntervalEnabled = useFeatureFlag('ALERTS_15_MINUTE_INTERVAL')
- const _alertLogic = alertLogic({ alertId, historyChartEnabled: alertsHistoryChartEnabled })
+ const _alertLogic = alertLogic({ alertId })
const { alert, alertLoading } = useValues(_alertLogic)
/** Parent callback only (e.g. close modal). `alertLogic` is hydrated from the save response inside `alertFormLogic`. */
@@ -146,7 +145,6 @@ export function EditAlertModal({
onEditSuccess: _onEditSuccess,
insightVizDataLogicProps: insightLogicProps,
insightInterval: trendInterval ?? undefined,
- historyChartEnabled: alertsHistoryChartEnabled,
}
const formLogic = alertFormLogic(formLogicProps)
const {
@@ -165,7 +163,6 @@ export function EditAlertModal({
const projectTimezone = currentTeam?.timezone ?? 'UTC'
const anomalyDetectionEnabled = useFeatureFlag('ALERTS_ANOMALY_DETECTION')
const inlineNotificationsEnabled = useFeatureFlag('ALERTS_INLINE_NOTIFICATIONS')
- const quietHoursEnabled = useFeatureFlag('ALERTS_QUIET_HOURS')
const investigationAgentEnabled = useFeatureFlag('ALERTS_INVESTIGATION_AGENT')
const { pendingNotifications } = useValues(alertNotificationLogic({ alertId: alertId }))
@@ -220,7 +217,7 @@ export function EditAlertModal({
) {
n += 1
}
- if (quietHoursEnabled && (alertForm.schedule_restriction?.blocked_windows?.length ?? 0) > 0) {
+ if ((alertForm.schedule_restriction?.blocked_windows?.length ?? 0) > 0) {
n += 1
}
return n
@@ -230,7 +227,6 @@ export function EditAlertModal({
alertForm.schedule_restriction?.blocked_windows?.length,
alertForm.skip_weekend,
can_check_ongoing_interval,
- quietHoursEnabled,
])
return (
@@ -798,16 +794,14 @@ export function EditAlertModal({
}
/>
</LemonField>
- {quietHoursEnabled ? (
- <QuietHoursFields
- scheduleRestriction={alertForm.schedule_restriction}
- calculationInterval={alertForm.calculation_interval}
- teamTimezone={projectTimezone}
- onChange={(next) =>
- setAlertFormValue('schedule_restriction', next)
- }
- />
- ) : null}
+ <QuietHoursFields
+ scheduleRestriction={alertForm.schedule_restriction}
+ calculationInterval={alertForm.calculation_interval}
+ teamTimezone={projectTimezone}
+ onChange={(next) =>
+ setAlertFormValue('schedule_restriction', next)
+ }
+ />
</div>
),
},
@@ -820,7 +814,7 @@ export function EditAlertModal({
alert ? (
<AlertHistorySection alertId={alert.id} />
) : alertLoading ? (
- <AlertHistorySectionSkeleton showChartArea={alertsHistoryChartEnabled} />
+ <AlertHistorySectionSkeleton />
) : null
) : null}
</LemonModal.Content>
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 042f69f3ed8a..fa55e1cea4fd 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -229,14 +229,10 @@ export const FEATURE_FLAGS = {
ACTION_REFERENCE_COUNT: 'action-reference-count', // owner: @andyzzhao #team-product-analytics, gates bulk action reference counting on actions list
ADVANCE_MARKETING_ANALYTICS_SETTINGS: 'advance-marketing-analytics-settings', // owner: @jabahamondes #team-web-analytics
AI_EVENTS_TABLE_ROLLOUT: 'ai-events-table-rollout', // owner: #team-llm-analytics, gates reads off the dedicated ai_events table
- /** Alert edit modal: check history chart + chart/table toggle (table remains when off). */
ALERTS_15_MINUTE_INTERVAL: 'alerts-15-minute-interval', // owner: #team-analytics-platform, gates 15-minute insight alert interval
ALERTS_ANOMALY_DETECTION: 'alerts-anomaly-detection', // owner: @andrewm4894
- ALERTS_HISTORY_CHART: 'alerts-history-chart', // owner: #team-analytics-platform
ALERTS_INLINE_NOTIFICATIONS: 'alerts-inline-notifications', // owner: @vdekrijger
ALERTS_INVESTIGATION_AGENT: 'alerts-investigation-agent', // owner: @andrewm4894, anomaly alerts — investigation agent on firing
- /** Insight alert quiet hours (schedule restriction UI; backend field is always honored when set). */
- ALERTS_QUIET_HOURS: 'alerts-quiet-hours', // owner: @mattp, #team-analytics-platform
AMPLITUDE_BATCH_IMPORT_OPTIONS: 'amplitude-batch-import-options', // owner: #team-ingestion
APPROVALS: 'approvals', // owner: @yasen-posthog #team-platform-features
AVERAGE_PAGE_VIEW_COLUMN: 'average-page-view-column', // owner: @jordanm-posthog #team-web-analytics