-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(experiments): new experiment query and metric interfaces #28367
feat(experiments): new experiment query and metric interfaces #28367
Conversation
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.
PR Summary
This PR introduces a significant architectural change to experiment metrics and queries in PostHog, moving from a count-based to a metric-based interface.
- Added new
ExperimentMetricType
enum inschema.py
to support different metric types (count, continuous, funnel) - Introduced
ExperimentEventMetricConfig
andExperimentDataWarehouseMetricConfig
classes for flexible metric configuration - Simplified query runner by removing math aggregation handling in favor of explicit metric types in
experiment_query_runner.py
- Restructured query generation to handle different metric types and configurations through a dedicated
self.metric
attribute - Updated test suite to validate new metric interfaces and configurations, removing flaky test decorators
3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
posthog/schema.py
Outdated
# Winsorize the metric at a certain percentile threshold, etc. | ||
# Override priors | ||
# Is the goal is to increase or decrease the metric, ex. | ||
inverse: Optional[bool] = 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.
logic: math_hogql and math_property are mutually exclusive - should add validation to ensure only one is set
Changes
Introduce new interfaces for experiment queries and metrics.
Still WIP, so ignore all polishing stuff. The important thing here is the new objects in schema.py and how they are to work with and pass around.
How did you test this code?