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

Move adding feature flags to event to capture endpoint #3090

Merged
merged 8 commits into from
Jan 26, 2021

Conversation

Twixes
Copy link
Collaborator

@Twixes Twixes commented Jan 26, 2021

Changes

This will save us a ton of work by moving adding feature flags to event properties earlier in the Python part of the pipeline, instead of forcing us to redo this in JS.

@timgl timgl temporarily deployed to posthog-capture-py-feat-gizf0s January 26, 2021 16:34 Inactive
Copy link
Collaborator

@timgl timgl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine to merge, but can you keep an eye on the endpoint stats to see if this dramatically increases the time it takes to post stuff?

@mariusandra
Copy link
Collaborator

This changes one thing with all events: adds a properties object. Until now many plugins had hooks like if (event.properties) { event.properties.hello = 'world' }, as some events, namely $identify don't come with properties.

@mariusandra
Copy link
Collaborator

mariusandra commented Jan 26, 2021

Also, tests are failing because of this.

Note, I'd actually be in favor of making sure all events always have a properties dict attached to them. It would make a lot of plugins easier to write, as you wouldn't have to worry if the object is undefined or not.

@Twixes Twixes temporarily deployed to posthog-capture-py-feat-gizf0s January 26, 2021 16:39 Inactive
posthog/api/capture.py Outdated Show resolved Hide resolved
@Twixes
Copy link
Collaborator Author

Twixes commented Jan 26, 2021

Obvs, will watch this @timgl
Yep, noticed @mariusandra Actually I just made the change so that it'd only add properties if also filling it with $feature_flags to conform with tests, but we can also ensure that properties are always a thing. WDYT?

@Twixes Twixes temporarily deployed to posthog-capture-py-feat-gizf0s January 26, 2021 16:44 Inactive
@mariusandra
Copy link
Collaborator

I guess we can accept missing properties here and just add an empty object in the plugin server to make life easier for plugins.

@Twixes Twixes temporarily deployed to posthog-capture-py-feat-gizf0s January 26, 2021 16:54 Inactive
@Twixes Twixes temporarily deployed to posthog-capture-py-feat-gizf0s January 26, 2021 17:03 Inactive
@Twixes Twixes temporarily deployed to posthog-capture-py-feat-gizf0s January 26, 2021 17:06 Inactive
@Twixes Twixes temporarily deployed to posthog-capture-py-feat-gizf0s January 26, 2021 17:11 Inactive
@Twixes Twixes merged commit 00b5edf into master Jan 26, 2021
@Twixes Twixes deleted the capture-py-feature-flags branch January 26, 2021 17:23
Twixes added a commit that referenced this pull request Jan 26, 2021
Twixes added a commit that referenced this pull request Jan 26, 2021
Twixes added a commit that referenced this pull request Jan 26, 2021
Twixes added a commit that referenced this pull request Jan 26, 2021
@fuziontech fuziontech mentioned this pull request Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants