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

feat(batch-exports): Support for event property filters #27921

Merged
merged 28 commits into from
Jan 29, 2025

Conversation

tomasfarias
Copy link
Contributor

Problem

As described in #26415, users wish to filter batch exports using properties. This is currently not supported by batch exports, so this PR adds support for it. See breakdown of all changes.

Changes

Backend

  • BatchExportModel now accepts serialized HogQL event property filters in a new attribute filters.
  • These filters are now parsed to a clickhouse expression when initializing the record batch producer (as a consequence, Producer.start is now async).
  • After parsed, filters are included in event queries used in batch exports.
    • As a consequence, batch export queries had to be expanded, and the events_batch_export_* views are no longer in use.

Frontend

  • Added a PropertyFilter component.
  • Moved all model selection options to the left, and destination specific configuration to the right.
  • Updated components used to set exclude_events and include_events.
    image

TODO

Only event properties can be used in filters. A follow-up PR will expand this for person properties too.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

Added a new model to S3 tests that has property filters. UI stuff tested manually.

@tomasfarias tomasfarias requested a review from rossgray January 27, 2025 16:16
@tomasfarias tomasfarias marked this pull request as draft January 27, 2025 16:17
@tomasfarias
Copy link
Contributor Author

Making a draft while I fix some conflicts, some test failures, and address an issue with the UI.

@tomasfarias tomasfarias force-pushed the feat/property-filters-for-batch-exports branch from 3ee4a41 to 3a662da Compare January 27, 2025 16:26
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor

github-actions bot commented Jan 27, 2025

Size Change: 0 B

Total Size: 1.16 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.16 MB

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@tomasfarias tomasfarias force-pushed the feat/property-filters-for-batch-exports branch from 3ea4b04 to cc6de9c Compare January 28, 2025 12:13
Copy link
Contributor

@rossgray rossgray left a comment

Choose a reason for hiding this comment

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

Changes look good. Just added some comments to help me understand a few things

@tomasfarias tomasfarias marked this pull request as ready for review January 28, 2025 14:10
@tomasfarias tomasfarias force-pushed the feat/property-filters-for-batch-exports branch from ed22b04 to e56c7c5 Compare January 29, 2025 10:42
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor

@rossgray rossgray left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@tomasfarias tomasfarias enabled auto-merge (squash) January 29, 2025 13:12
@tomasfarias tomasfarias merged commit 9ea1fc2 into master Jan 29, 2025
99 checks passed
@tomasfarias tomasfarias deleted the feat/property-filters-for-batch-exports branch January 29, 2025 13:31
adamleithp pushed a commit that referenced this pull request Jan 29, 2025
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
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