: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
feat(logs): add first alert empty state (#73556)
Matt Pua495fa9a2c739
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex bfe95a95999a..8c6831abc7f4 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -4678,6 +4678,10 @@ snapshots:hash: v1.k794b7964.1b0b3ec51cc999c02f8442559b676a2e2f352998c0f3d4a9b10da7da8fc3aac1.ZktPS8oprYMZQ-rLsncCgMlyidqF97zUzqDfKjQGo1Aproducts-alerts-alert-modal--edit-alert--light:hash: v1.k794b7964.38643f06f9a727b550dfcde1c46769c13a24bcc43877362c3d6feab29fd2f581.L1ItMn6mhr4o_vWqlI3lpil3yPPBgM0BgUa-yB6TzUQ+ products-alerts-alerts-scene--empty-log-alerts--dark:+ hash: v1.k794b7964.a9868dcf76f660a4b877ab75f7d250c5d9f88bb80c7569894ffd8b7dd47349eb.7b0VesDoG7DV59GvcHn7THcPrfCa6gx0H3IikajV1EA+ products-alerts-alerts-scene--empty-log-alerts--light:+ hash: v1.k794b7964.1caf4a25eab1c156cfe2fe0fdc28445f1312da38d9c3b21f2661ed7c1af9ad8d.ZfbubAvXZgUCHxZif8hN8LUQfZRlWV8nuVA36LOW2Pwproducts-alerts-alerts-scene--empty-state--dark:hash: v1.k794b7964.b419d15fe1d77892d0bc6aa978baa0075f2b64e597b8b457b59daaf7d3268f1a.mxxfJ0VEg12SBSXNmlykTeIIj7jKxPkBHSB2399bnusproducts-alerts-alerts-scene--empty-state--light:diff --git a/products/alerts/frontend/AlertsScene.stories.tsx b/products/alerts/frontend/AlertsScene.stories.tsxindex ee0e9a6ae062..7fc5073fa2cf 100644--- a/products/alerts/frontend/AlertsScene.stories.tsx+++ b/products/alerts/frontend/AlertsScene.stories.tsx@@ -215,3 +215,16 @@ export const LogAlerts: Story = {}),],}++export const EmptyLogAlerts: Story = {+ parameters: {+ pageUrl: `${urls.alerts()}?alert_type=logs`,+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:team_id/logs/alerts/': EMPTY_PAGINATED_RESPONSE,+ },+ }),+ ],+}diff --git a/products/logs/frontend/components/LogsAlerting/LogsAlertList.tsx b/products/logs/frontend/components/LogsAlerting/LogsAlertList.tsxindex 8eb9dad2e327..c68b8153625d 100644--- a/products/logs/frontend/components/LogsAlerting/LogsAlertList.tsx+++ b/products/logs/frontend/components/LogsAlerting/LogsAlertList.tsx@@ -1,6 +1,7 @@import { useActions, useValues } from 'kea'-import { IconBell, IconEllipsis } from '@posthog/icons'+import * as magnifyingGlassPng from '@posthog/brand/hoggies/png/magnifying-glass'+import { IconBell, IconEllipsis, IconPlus } from '@posthog/icons'import {LemonButton,LemonDialog,@@ -12,7 +13,9 @@ import {SpinnerOverlay,} from '@posthog/lemon-ui'+import { pngHoggie } from 'lib/brand/hoggies'import { MemberSelect } from 'lib/components/MemberSelect'+import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'import { TZLabel } from 'lib/components/TZLabel'import { createdByColumn } from 'lib/lemon-ui/LemonTable/columnUtils'import { Tooltip } from 'lib/lemon-ui/Tooltip'@@ -27,6 +30,8 @@ import {} from 'lib/ui/quill'import { urls } from 'scenes/urls'+import { ProductKey } from '~/queries/schema/schema-general'+import IconMicrosoftTeams from 'public/services/microsoft-teams.png'import IconSlack from 'public/services/slack.png'import IconWebhook from 'public/services/webhook.svg'@@ -49,6 +54,8 @@ const DESTINATION_TAGS = [{ type: NotificationDestinationTypeEnumApi.Teams, label: 'Teams', icon: IconMicrosoftTeams },] as const+const HedgehogMagnifyingGlass = pngHoggie(magnifyingGlassPng)+function formatThreshold(alert: LogsAlertConfigurationApi): string {const operator = alert.threshold_operator === LogsAlertThresholdOperatorEnumApi.Below ? '<' : '>'return `${operator} ${alert.threshold_count} in ${alert.window_minutes}m`@@ -283,6 +290,31 @@ export function LogsAlertList(): JSX.Element {return <SpinnerOverlay />}+ if (alerts.length === 0 && !createdByFilter) {+ return (+ <ProductIntroduction+ productName="Logs alerts"+ productKey={ProductKey.ALERTS}+ thingName="logs alert"+ description="Logs alerts notify you when matching logs cross a threshold."+ isEmpty+ customHog={HedgehogMagnifyingGlass}+ actionElementOverride={+ <LemonButton+ type="primary"+ icon={<IconPlus />}+ onClick={() => createAlertAndOpen()}+ loading={creatingAlert}+ data-attr="logs-alerts-new"+ >+ Create alert+ </LemonButton>+ }+ docsURL="https://posthog.com/docs/logs/alerts"+ />+ )+ }+return (<div className="space-y-2"><div className="flex justify-end gap-2 flex-wrap">