fix(lifecycle): filter out personless events from lifecycle insights #27118
+69
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Anonymous persons show up as resurrecting in lifecycle insights. This is because we look at the persons’ created at (
events.person.created_at
) to determine wether they are new or resurrecting. Since anonymous persons don't have a person profile, this property isnull
which then looks like the person has been there since the beginning of (unix) time.Closes: #25367
Changes
This PR filter out personless events in the lifecycle insight.
An alternative approach would be to look at the first event associated with each person_id for anonymous users. However, I don’t see a performant way to achieve this without creating some form of a person profile. For thoroughness, I attempted to join an events query without date limits, but this exceeded the memory limit for our team.
tbd: how do we signal to users that this insight excludes anonymous events, while e.g. retention has them? just docs?
How did you test this code?
Added a test and manual testing
before:
after: