: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(error-tracking): show events for every issue fingerprint (#79130)
Hugues Pouillot75a926dc46e0
diff --git a/products/error_tracking/frontend/queries.test.ts b/products/error_tracking/frontend/queries.test.tsindex fa5dec1ba72e..4c33fac20c28 100644--- a/products/error_tracking/frontend/queries.test.ts+++ b/products/error_tracking/frontend/queries.test.ts@@ -33,7 +33,7 @@ describe('queries', () => {describe('error tracking query tags', () => {it('tags issue event queries as error tracking', () => {const actual = errorTrackingIssueEventsQuery({- fingerprints: ['abc'],+ issueId: '01936e7f-d7ff-7314-b2d4-7627981e34f0',filterTestAccounts: false,filterGroup: {type: FilterLogicalOperator.And,@@ -52,9 +52,9 @@ describe('queries', () => {expect(actual.tags).toEqual({ productKey: ProductKey.ERROR_TRACKING })})- it('escapes quotes in fingerprints and search text', () => {+ it('filters issue events by the resolved issue ID and escapes search text', () => {const actual = errorTrackingIssueEventsQuery({- fingerprints: ["fp_with_'quote"],+ issueId: '01936e7f-d7ff-7314-b2d4-7627981e34f0',filterTestAccounts: false,filterGroup: {type: FilterLogicalOperator.And,@@ -71,7 +71,8 @@ describe('queries', () => {})const where = (actual.where ?? []).join(' ')- expect(where).toContain("'fp_with_\\'quote'")+ expect(where).toContain("issue_id_v2 = toUUID('01936e7f-d7ff-7314-b2d4-7627981e34f0')")+ expect(where).not.toContain('$exception_fingerprint')expect(where).toContain("'%O\\'Brien%'")})diff --git a/products/error_tracking/frontend/queries.ts b/products/error_tracking/frontend/queries.tsindex ea96f8fb658d..3d56b813327c 100644--- a/products/error_tracking/frontend/queries.ts+++ b/products/error_tracking/frontend/queries.ts@@ -137,14 +137,14 @@ export const errorTrackingIssueQuery = ({}export const errorTrackingIssueEventsQuery = ({- fingerprints,+ issueId,filterTestAccounts,filterGroup,searchQuery,dateRange,columns,}: {- fingerprints: string[]+ issueId: stringfilterTestAccounts: booleanfilterGroup: UniversalFiltersGroupsearchQuery: string@@ -154,7 +154,7 @@ export const errorTrackingIssueEventsQuery = ({const group = filterGroup.values[0] as UniversalFiltersGroupconst properties = [...group.values] as AnyPropertyFilter[]- let where_string = `properties.$exception_fingerprint in [${fingerprints.map((f) => escapeHogQLString(f)).join(', ')}] AND isNotNull(properties.$exception_issue_id)`+ let where_string = `issue_id_v2 = toUUID(${escapeHogQLString(issueId)})`if (searchQuery) {// This is an ugly hack for the fact I don't think we support nested property filters in// the eventsquerydiff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.test.ts b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.test.tsindex 7d54a02def57..90d526414257 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.test.ts+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.test.ts@@ -31,29 +31,21 @@ describe('errorTrackingIssueSceneLogic', () => {afterEach(() => logic?.unmount())- // eventsQueryKey is the kea key of the events table's data source logic: every key change- // unmounts and remounts the whole table tree. It used to be uuid() per recompute, so even a- // deep-equal fingerprints refetch rebuilt the table. These lock in the key contract both ways.- it('keeps eventsQuery and eventsQueryKey stable across deep-equal fingerprint loads', () => {+ it('keeps the events query stable when the loaded fingerprints change', () => {logic.actions.loadIssueFingerprintsSuccess(makeFingerprints())const initialQuery = logic.values.eventsQueryconst initialKey = logic.values.eventsQueryKey- // Freshly constructed but deep-equal — as a refetch would deliver.- logic.actions.loadIssueFingerprintsSuccess(makeFingerprints())+ logic.actions.loadIssueFingerprintsSuccess(makeFingerprints('fp-2'))expect(logic.values.eventsQuery).toBe(initialQuery)expect(logic.values.eventsQueryKey).toBe(initialKey)})- it.each<[string, (logic: ReturnType<typeof errorTrackingIssueSceneLogic.build>) => void]>([- ['fingerprints change', (l) => l.actions.loadIssueFingerprintsSuccess(makeFingerprints('fp-2'))],- ['search query changes', (l) => l.actions.setSearchQuery('needle')],- ])('changes eventsQueryKey when the %s', (_name, mutate) => {- logic.actions.loadIssueFingerprintsSuccess(makeFingerprints())+ it('changes the events query key when the search query changes', () => {const initialKey = logic.values.eventsQueryKey- mutate(logic)+ logic.actions.setSearchQuery('needle')expect(logic.values.eventsQueryKey).not.toBe(initialKey)})diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.ts b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.tsindex cdec201c8838..58a04072abee 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.ts+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.ts@@ -500,7 +500,7 @@ export interface errorTrackingIssueSceneLogicMeta {firstSeen: (issue: ErrorTrackingRelationalIssue | null) => Dayjs | nullaggregations: (summary: ErrorTrackingIssueSummary | null) => ErrorTrackingIssueAggregations | undefinedeventsQuery: (- issueFingerprints: ErrorTrackingFingerprint[],+ issueId: string,filterTestAccounts: boolean,searchQuery: string,filterGroup: UniversalFiltersGroup,@@ -800,24 +800,23 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicTypeaggregations: [(s) => [s.summary], (summary: ErrorTrackingIssueSummary | null) => summary?.aggregations],eventsQuery: [- (s) => [s.issueFingerprints, s.filterTestAccounts, s.searchQuery, s.filterGroup, s.dateRange],+ (s) => [s.issueId, s.filterTestAccounts, s.searchQuery, s.filterGroup, s.dateRange],(- issueFingerprints: ErrorTrackingFingerprint[],+ issueId: string,filterTestAccounts: boolean,searchQuery: string,filterGroup: UniversalFiltersGroup,dateRange: DateRange) =>errorTrackingIssueEventsQuery({- fingerprints: issueFingerprints.map((f: ErrorTrackingFingerprint) => f.fingerprint),+ issueId,filterTestAccounts,filterGroup,searchQuery,dateRange,columns: ['*', 'timestamp', 'person'],}),- // Deep-equal recomputes (e.g. a fingerprints refetch returning the same list) must not- // produce a new query identity, or the key below remounts the whole events table.+ // Preserve the query identity when selector inputs are deep-equal to avoid remounting the events table.{ resultEqualityCheck: objectsEqual },],