Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cdp): Error tracking notifications #27072

Draft
wants to merge 71 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
e8d7742
move config to tabs
daibhin Dec 17, 2024
f6ae828
add destinations table
daibhin Dec 17, 2024
04d0e99
separate alerting create page
daibhin Dec 17, 2024
56c1588
Started adding internal events topic
benjackwhite Dec 18, 2024
1e7c936
Fixes
benjackwhite Dec 18, 2024
66374cc
Fixes
benjackwhite Dec 18, 2024
38d25b9
Fix up manager
benjackwhite Dec 18, 2024
37a99ee
Fixes
benjackwhite Dec 18, 2024
68c2605
Fix up tests
benjackwhite Dec 18, 2024
b3606e3
Fixes
benjackwhite Dec 18, 2024
28a8f54
Fix added internal events
benjackwhite Dec 18, 2024
e302623
Fix
benjackwhite Dec 18, 2024
3360444
fix
benjackwhite Dec 18, 2024
53d8405
Fixes
benjackwhite Dec 19, 2024
d80ff23
Merge branch 'master' into feat/cdp-internal-events
benjackwhite Dec 19, 2024
b635dbd
Fix up types and add activity log
benjackwhite Dec 19, 2024
f0c858d
fixes
benjackwhite Dec 19, 2024
de363f5
Fixes
benjackwhite Dec 19, 2024
4fc3919
Fixes
benjackwhite Dec 19, 2024
8afbcac
Fixes
benjackwhite Dec 19, 2024
b84b23d
Fixes
benjackwhite Dec 19, 2024
cdfa344
Fixes
benjackwhite Dec 19, 2024
90b8df0
Fix up
benjackwhite Dec 19, 2024
3638940
Fixes
benjackwhite Dec 19, 2024
31a2e49
Fixes
benjackwhite Dec 19, 2024
0b7fbff
Fixes
benjackwhite Dec 19, 2024
9716c5e
Merge branch 'master' into feat/cdp-internal-events
benjackwhite Dec 19, 2024
776fe93
Fix - don't include choice in the DB side of things
benjackwhite Dec 19, 2024
f6f20f0
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
4b040e1
Merge branch 'master' into feat/drop-hog-function-type
benjackwhite Dec 19, 2024
3fb0483
Fix
benjackwhite Dec 19, 2024
8b495c5
Merge branch 'feat/cdp-internal-events' of github.com:PostHog/posthog…
benjackwhite Dec 19, 2024
eaf2f5d
Merge branch 'dn-feat/alerting-frontend' into feat/cdp-error-events
benjackwhite Dec 19, 2024
33c9fd4
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
d424ac7
Moving
benjackwhite Dec 19, 2024
bdbf84e
Fixes
benjackwhite Dec 19, 2024
55818b3
Remove templates stuff
benjackwhite Dec 19, 2024
518fd97
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
e2990b1
Merge branch 'feat/cdp-internal-events' into feat/cdp-error-events
benjackwhite Dec 19, 2024
981ab0e
Update UI snapshots for `chromium` (1)
github-actions[bot] Dec 19, 2024
867c4fa
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
c3e0697
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
492cf72
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
3a06160
Fixes
benjackwhite Dec 19, 2024
3e9b0b0
fixes
benjackwhite Dec 19, 2024
1a8b3c3
Update UI snapshots for `chromium` (1)
github-actions[bot] Dec 19, 2024
e852026
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
c0addcd
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
9e09867
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
6499831
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
637ac53
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
e83a9b2
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
b5912a2
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
0502553
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
2fca363
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
8edb318
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
2be5576
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
15a7139
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 19, 2024
0ac0f76
Merge branch 'master' into feat/cdp-internal-events
benjackwhite Dec 20, 2024
0d1356a
Merge branch 'feat/cdp-internal-events' into feat/cdp-error-events
benjackwhite Dec 20, 2024
9c805fc
Merge branch 'master' into feat/drop-hog-function-type
benjackwhite Dec 20, 2024
087a7a7
Merge branch 'feat/drop-hog-function-type' into feat/cdp-internal-events
benjackwhite Dec 20, 2024
7794fef
Merge branch 'feat/cdp-internal-events' into feat/cdp-error-events
benjackwhite Dec 20, 2024
a68a75f
Fix
benjackwhite Dec 20, 2024
a66b8b7
Fix
benjackwhite Dec 20, 2024
4353b77
Merge branch 'feat/cdp-internal-events' into feat/cdp-error-events
benjackwhite Dec 20, 2024
ecb9092
Fixes
benjackwhite Dec 20, 2024
29070fa
Merge branch 'master' into feat/cdp-internal-events
benjackwhite Dec 23, 2024
ecc80fb
Merge branch 'feat/cdp-internal-events' into feat/cdp-error-events
benjackwhite Dec 23, 2024
0e0a080
Update UI snapshots for `chromium` (2)
github-actions[bot] Dec 23, 2024
227bc8a
Merge branch 'master' into feat/cdp-error-events
benjackwhite Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function SidePanelActivitySubscriptions(): JSX.Element {
<p>Get notified of your team's activity</p>

<LinkedHogFunctions
logicKey="activity-log"
type="internal_destination"
subTemplateId="activity-log"
filters={{
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/actions/ActionHogFunctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function ActionHogFunctions(): JSX.Element | null {
) : null}

<LinkedHogFunctions
logicKey="actions"
type="destination"
filters={filters}
newDisabledReason={
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/scenes/appScenes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export const appScenes: Record<Scene, () => any> = {
[Scene.EarlyAccessFeatures]: () => import('./early-access-features/EarlyAccessFeatures'),
[Scene.EarlyAccessFeature]: () => import('./early-access-features/EarlyAccessFeature'),
[Scene.ErrorTracking]: () => import('./error-tracking/ErrorTrackingScene'),
[Scene.ErrorTrackingConfiguration]: () => import('./error-tracking/ErrorTrackingConfigurationScene'),
[Scene.ErrorTrackingAlerts]: () => import('./error-tracking/alerts/ErrorTrackingAlertsScene'),
[Scene.ErrorTrackingAlert]: () => import('./error-tracking/alerts/ErrorTrackingAlertScene'),
[Scene.ErrorTrackingSymbolSets]: () => import('./error-tracking/symbol-sets/ErrorTrackingSymbolSetsScene'),
[Scene.ErrorTrackingIssue]: () => import('./error-tracking/ErrorTrackingIssueScene'),
[Scene.Surveys]: () => import('./surveys/Surveys'),
[Scene.Survey]: () => import('./surveys/Survey'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ export function DefinitionView(props: DefinitionLogicProps = {}): JSX.Element {
<LemonDivider className="my-6" />
<div className="flex flex-wrap">
{isEvent && definition.created_at && (
<div className="flex-1 flex flex-col">
<div className="flex flex-col flex-1">
<h5>First seen</h5>
<b>
<TZLabel time={definition.created_at} />
</b>
</div>
)}
{isEvent && definition.last_seen_at && (
<div className="flex-1 flex flex-col">
<div className="flex flex-col flex-1">
<h5>Last seen</h5>
<b>
<TZLabel time={definition.last_seen_at} />
Expand All @@ -200,7 +200,7 @@ export function DefinitionView(props: DefinitionLogicProps = {}): JSX.Element {
)}

{isProperty && (
<div className="flex-1 flex flex-col">
<div className="flex flex-col flex-1">
<h5>Property type</h5>
<b>{(definition as PropertyDefinition).property_type ?? '-'}</b>
</div>
Expand All @@ -218,6 +218,7 @@ export function DefinitionView(props: DefinitionLogicProps = {}): JSX.Element {
<p>Get notified via Slack, webhooks or more whenever this event is captured.</p>

<LinkedHogFunctions
logicKey="event-definitions"
type="destination"
filters={{
events: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element {
<h3>Notifications</h3>
<p>Get notified when people opt in or out of your feature.</p>
<LinkedHogFunctions
logicKey="eaf"
type="destination"
filters={destinationFilters}
subTemplateId="early-access-feature-enrollment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AssigneeSelect } from './AssigneeSelect'
import ErrorTrackingFilters from './ErrorTrackingFilters'
import { errorTrackingIssueSceneLogic } from './errorTrackingIssueSceneLogic'
import { OverviewTab } from './groups/OverviewTab'
import { SymbolSetUploadModal } from './SymbolSetUploadModal'
import { SymbolSetUploadModal } from './symbol-sets/SymbolSetUploadModal'

export const scene: SceneExport = {
component: ErrorTrackingIssueScene,
Expand Down
38 changes: 25 additions & 13 deletions frontend/src/scenes/error-tracking/ErrorTrackingScene.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { TZLabel } from '@posthog/apps-common'
import { IconGear } from '@posthog/icons'
import { LemonButton, LemonCheckbox, LemonDivider, LemonSegmentedButton } from '@posthog/lemon-ui'
import { IconEllipsis, IconGear } from '@posthog/icons'
import {
LemonButton,
LemonCheckbox,
LemonDivider,
LemonMenu,
LemonMenuItems,
LemonSegmentedButton,
} from '@posthog/lemon-ui'
import clsx from 'clsx'
import { BindLogic, useActions, useValues } from 'kea'
import { FeedbackNotice } from 'lib/components/FeedbackNotice'
Expand Down Expand Up @@ -176,21 +183,26 @@ const AssigneeColumn: QueryContextColumnComponent = (props) => {
const Header = (): JSX.Element => {
const { user } = useValues(userLogic)

const items: LemonMenuItems = [{ label: 'Manage symbol sets', to: urls.errorTrackingSymbolSets() }]

if (user?.is_staff) {
items.push({
label: 'Send an exception',
onClick: () => {
throw Error('Oh my!')
},
})
}

return (
<PageHeader
buttons={
<>
{user?.is_staff ? (
<LemonButton
onClick={() => {
throw Error('Oh my!')
}}
>
Send an exception
</LemonButton>
) : null}
<LemonButton to={urls.errorTrackingConfiguration()} type="secondary" icon={<IconGear />}>
Configure
<LemonMenu items={items}>
<LemonButton icon={<IconEllipsis />} />
</LemonMenu>
<LemonButton to={urls.errorTrackingAlerts()} type="secondary" icon={<IconGear />}>
Configure alerts
</LemonButton>
</>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { kea, path, props, selectors } from 'kea'
import { HogFunctionConfiguration } from 'scenes/pipeline/hogfunctions/HogFunctionConfiguration'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'

import { Breadcrumb } from '~/types'

import type { errorTrackingAlertSceneLogicType } from './ErrorTrackingAlertSceneType'

export const errorTrackingAlertSceneLogic = kea<errorTrackingAlertSceneLogicType>([
path((key) => ['scenes', 'error-tracking', 'errorTrackingAlertSceneLogic', key]),
props({} as { id: string }),
selectors({
breadcrumbs: [
(_, p) => [p.id],
(id): Breadcrumb[] => [
{
key: Scene.ErrorTracking,
path: urls.errorTracking(),
name: 'Error tracking',
},
{
key: Scene.ErrorTrackingAlerts,
path: urls.errorTrackingAlerts(),
name: 'Alerts',
},
{
key: Scene.ErrorTrackingAlert,
name: id === 'new' ? 'Create alert' : 'Edit alert',
},
],
],
}),
])

export const scene: SceneExport = {
component: ErrorTrackingAlertScene,
logic: errorTrackingAlertSceneLogic,
paramsToProps: ({ params: { id } }): (typeof errorTrackingAlertSceneLogic)['props'] => ({ id }),
}

export function ErrorTrackingAlertScene(): JSX.Element {
return <HogFunctionConfiguration id={null} templateId="template-error-tracking-alert" />
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { LemonButton } from '@posthog/lemon-ui'
import { kea, path, selectors } from 'kea'
import { PageHeader } from 'lib/components/PageHeader'
import { LinkedHogFunctions } from 'scenes/pipeline/hogfunctions/list/LinkedHogFunctions'
import { SceneExport } from 'scenes/sceneTypes'
import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'

import { Breadcrumb } from '~/types'

import type { errorTrackingAlertsSceneLogicType } from './ErrorTrackingAlertsSceneType'

export const errorTrackingAlertsSceneLogic = kea<errorTrackingAlertsSceneLogicType>([
path(['scenes', 'error-tracking', 'errorTrackingAlertsSceneLogic']),
selectors({
breadcrumbs: [
() => [],
(): Breadcrumb[] => [
{
key: Scene.ErrorTracking,
name: 'Error tracking',
path: urls.errorTracking(),
},
{
key: Scene.ErrorTrackingAlerts,
name: 'Alerts',
},
],
],
}),
])

export const scene: SceneExport = {
component: ErrorTrackingAlertsScene,
logic: errorTrackingAlertsSceneLogic,
}

export function ErrorTrackingAlertsScene(): JSX.Element {
return (
<>
<PageHeader
buttons={
<LemonButton type="primary" to={urls.errorTrackingAlert('new')} className="flex">
Setup alert
</LemonButton>
}
/>

<LinkedHogFunctions
logicKey="error-tracking-alerts"
type="internal_destination"
subTemplateId="errors"
filters={{
events: [
{
id: `$error_something`,
type: 'events',
},
],
}}
/>
{/* <DestinationsTable types={['error_tracking_alert']} hideKind hideFeedback /> */}
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,7 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicType
actionToUrl(({ values }) => ({
setTab: () => {
const searchParams = router.values.searchParams

if (values.tab != IssueTab.Overview) {
searchParams['tab'] = values.tab
}

searchParams['tab'] = values.tab
return [router.values.location.pathname, searchParams]
},
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ import { humanFriendlyDetailedTime } from 'lib/utils'
import { useEffect, useState } from 'react'
import { SceneExport } from 'scenes/sceneTypes'

import { AlphaAccessScenePrompt } from './AlphaAccessScenePrompt'
import { errorTrackingSymbolSetLogic } from './errorTrackingSymbolSetLogic'
import { SymbolSetUploadModal } from './SymbolSetUploadModal'

export const scene: SceneExport = {
component: ErrorTrackingConfigurationScene,
component: ErrorTrackingSymbolSetsScene,
logic: errorTrackingSymbolSetLogic,
}

export function ErrorTrackingConfigurationScene(): JSX.Element {
export default function ErrorTrackingSymbolSetsScene(): JSX.Element {
const { missingSymbolSets, validSymbolSets } = useValues(errorTrackingSymbolSetLogic)
const { loadSymbolSets } = useActions(errorTrackingSymbolSetLogic)

Expand All @@ -26,24 +25,21 @@ export function ErrorTrackingConfigurationScene(): JSX.Element {
}, [loadSymbolSets])

return (
<AlphaAccessScenePrompt>
<div className="space-y-4">
<h2>Symbol sets</h2>
<p>
Source maps are required to demangle any minified code in your exception stack traces. PostHog
automatically retrieves source maps where possible. Cases where it was not possible are listed
below. Source maps can be uploaded retroactively but changes will only apply to all future
exceptions ingested.
</p>
{missingSymbolSets.length > 0 && (
<SymbolSetTable id="missing" dataSource={missingSymbolSets} pageSize={5} missing />
)}
{(validSymbolSets.length > 0 || missingSymbolSets.length === 0) && (
<SymbolSetTable id="valid" dataSource={validSymbolSets} pageSize={10} />
)}
<SymbolSetUploadModal />
</div>
</AlphaAccessScenePrompt>
<div className="space-y-4">
<h2>Symbol sets</h2>
<p>
Source maps are required to demangle any minified code in your exception stack traces. PostHog
automatically retrieves source maps where possible. Cases where it was not possible are listed below.
Source maps can be uploaded retroactively but changes will only apply to all future exceptions ingested.
</p>
{missingSymbolSets.length > 0 && (
<SymbolSetTable id="missing" dataSource={missingSymbolSets} pageSize={5} missing />
)}
{(validSymbolSets.length > 0 || missingSymbolSets.length === 0) && (
<SymbolSetTable id="valid" dataSource={validSymbolSets} pageSize={10} />
)}
<SymbolSetUploadModal />
</div>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { urls } from 'scenes/urls'

import { Breadcrumb } from '~/types'

import type { errorTrackingSymbolSetLogicType } from './errorTrackingSymbolSetLogicType'
import type { errorTrackingSymbolSetLogicType } from '../symbol-sets/errorTrackingSymbolSetLogicType'

export enum ErrorGroupTab {
Overview = 'overview',
Expand Down Expand Up @@ -66,8 +66,8 @@ export const errorTrackingSymbolSetLogic = kea<errorTrackingSymbolSetLogicType>(
path: urls.errorTracking(),
},
{
key: Scene.ErrorTrackingConfiguration,
name: 'Configuration',
key: Scene.ErrorTrackingSymbolSets,
name: 'Symbol Sets',
},
],
],
Expand Down
16 changes: 12 additions & 4 deletions frontend/src/scenes/pipeline/destinations/Destinations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { NewButton } from '../NewButton'
import { pipelineAccessLogic } from '../pipelineAccessLogic'
import { Destination, PipelineBackend, SiteApp, Transformation } from '../types'
import { pipelineNodeMenuCommonItems, RenderApp, RenderBatchExportIcon } from '../utils'
import { DestinationsFilters } from './DestinationsFilters'
import { DestinationsFilters, DestinationsFiltersProps } from './DestinationsFilters'
import { destinationsFiltersLogic } from './destinationsFiltersLogic'
import { pipelineDestinationsLogic } from './destinationsLogic'
import { DestinationOptionsTable } from './NewDestinations'
Expand Down Expand Up @@ -79,15 +79,20 @@ export function Destinations({ types }: DestinationsProps): JSX.Element {
}
export type DestinationsTableProps = {
types: HogFunctionTypeType[]
hideFeedback?: boolean
hideAddDestinationButton?: boolean
}

export function DestinationsTable({
hideSearch,
hideFeedback,
hideAddDestinationButton,
hideKind,
hideShowPaused,
types,
}: DestinationsTableProps): JSX.Element {
}: DestinationsTableProps &
Pick<
DestinationsFiltersProps,
'hideSearch' | 'hideFeedback' | 'hideAddDestinationButton' | 'hideShowPaused' | 'hideKind'
>): JSX.Element {
const { canConfigurePlugins, canEnableDestination } = useValues(pipelineAccessLogic)
const { loading, filteredDestinations, destinations, hiddenDestinations } = useValues(
pipelineDestinationsLogic({ types })
Expand All @@ -107,8 +112,11 @@ export function DestinationsTable({
<div className="space-y-2">
<DestinationsFilters
types={types}
hideSearch={hideSearch}
hideFeedback={hideFeedback}
hideAddDestinationButton={hideAddDestinationButton}
hideKind={hideKind}
hideShowPaused={hideShowPaused}
/>

<LemonTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ const FILTER_OPTIONS = [
label: 'Team activity',
value: '$activity_log_entry_created',
},
{
label: 'New issue created',
value: '$error_tracking_alert_created',
},
{
label: 'Resolved issue reoccurs',
value: '$error_tracking_alert_reoccurred',
},
{
label: 'Assigned issue',
value: '$error_tracking_alert_assigned',
},
]

const getSimpleFilterValue = (value?: HogFunctionFiltersType): string | undefined => {
Expand Down
Loading
Loading