-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(plugin-server): handle process_person=false #21262
Conversation
bb714cb
to
35753a7
Compare
Oh, this one was unrelated but seems costly. I think by my count we were proactively serializing the whole event 6 times per full processing loop? I'm hoping I'm JSing wrong again. :) |
35753a7
to
2f506f3
Compare
// TODO: Move this into `normalizeEventStep` where it belongs, but the code structure | ||
// and tests demand this for now. | ||
for (let groupTypeIndex = 0; groupTypeIndex < this.db.MAX_GROUP_TYPES_PER_TEAM; ++groupTypeIndex) { | ||
const key = `$group_${groupTypeIndex}` | ||
delete properties[key] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm my understanding: we're removing group properties from the event here to match what we do for $set
and friends, correct?
But we keep group info, then we'll want to have these here.
I'd propose that we move everything groups into a separate step and handle it all there and not do anything within normalizeEventStep
- because later we might want to make that also look at their add-on selection - i.e. skip group properties if they have disabled that add-on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should refactor to have a group processing step.
But I'm not sure I follow these parts:
But we keep group info, then we'll want to have these here.
i.e. skip group properties if they have disabled that add-on
I thought for $process_person=false
we want don't want to process Group stuff at all? So I'm avoiding doing any Group lookups or adding Group fields. I can't tell if you're saying we want to do (some?) Group stuff for $process_person=false
events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a separate follow-up I think we should do, sorry for the confusion here.
What I'm thinking is
- we move all group stuff into a separate step
- we make that step be ignored if
$process_person=false
or group analytics addon is disabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah OK, agreed!
delete event.$set_once | ||
delete properties.$set | ||
delete properties.$set_once | ||
delete properties.$unset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is event.$unset
a thing also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going by what's on the type, but it appears we don't expect one. And we only read it from within properties
.
I can delete event['$unset']
to be safe if we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see, might be good to do that for consistency indeed (in case someone changes something later somewhere else)
delete properties.$set | ||
delete properties.$set_once | ||
delete properties.$unset | ||
properties.$process_person = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we either always keep it or always remove it, atm we keep if false and remove otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I chose to do yeah, I'm up for either. My thinking was it feels weird to add properties to every event when they aren't sending it, and true
is the default. (We also have the person_mode
column.)
If we'd rather always add it to every event, I can definitely do that. Will it not throw current users off to see a new $process_person=true
property on every event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about we just always remove it?
ac9caab
to
13c8aa2
Compare
13c8aa2
to
47c557c
Compare
47c557c
to
cb3ded9
Compare
Problem
We need to support
$process_person=false
by not handling person properties, groups, and by dropping some fields from the event.Note that we also need to skip some plugins, but that doesn't depend on this code and will be coming separately.
Changes
First, I'm not in love with where I had to squeeze things in. We want to get this out soon, so I can't afford to do the refactoring that I'd like to do. I do think a lot of this will become cleaner in the next phase, when (I think) the
person
object becomes optional and so we aren't passing around the extra bool to most steps, we just do work based on whether or not a real person object exists or not.Anyway, changes:
runner.ts
) extract the properprocessPerson
boolean
that is used for the rest of event processingprocessPerson
down so that we:$set
and related properties$identify
with an ingestion warningDoes this work well for both Cloud and self-hosted?
Yes.
How did you test this code?
Updated existing and added more.