-
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): project_id
in clickhouse_events_json
#25873
Conversation
97f98ce
to
c0345d0
Compare
const { eventUuid: uuid, event, teamId, distinctId, properties, timestamp } = preIngestionEvent | ||
|
||
let team = this.teamManager.getCachedTeam(teamId) |
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.
Not blocking, but this feels a bit like spooky action at a distance - is there any chance we could do this in the populateTeamData
step instead, where we know we're already fetching the team? I know that'd require a bit more wiring, but I'd prefer the "larger" change here I think
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.
Good point. Have rewritten to avoid any extra teamManager
calls. Now we set the project_id
here: https://github.com/PostHog/posthog/pull/25873/files#diff-51ee2dd21f9a70e91c6e2bf4a0c856040b7f5b7708cbea1c5d674fe1bd92b843R190
ea6b373
to
47ca021
Compare
47ca021
to
4e41d8a
Compare
Problem
To do project-based taxonomy, rather than team-based,
property-defs-rs
needs to be gettingproject_id
as part of event payloads. To do this, I propose we start including propertyproject_id
in theclickhouse_events_json
topic's payloads.Changes
We're now adding
project_id
right before producing events toclickhouse_events_json
.We are not using this
project_id
anywhere yet. The only place I'm planning to use it isproperty-defs-rs
in a follow-up PR.How did you test this code?
I saw we don't have any plugin server tests observing the
clickhouse_events_json
topic – all event processing tests fetch from ClickHouse instead. That's all good for most cases, except this particular one, asproject_id
is specifically key in Kafka payloads and ignored in ClickHouse.Hence added Kafka observation to
plugin-server/tests/worker/ingestion/process-event.test.ts
– inspired byplugin-server/functional_tests/scheduled-tasks-runner.test.ts
– and added aproject_id
assertion based on that.