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(experiments): new experiment query and metric interfaces #28367

Merged

Conversation

andehen
Copy link
Contributor

@andehen andehen commented Feb 6, 2025

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?

  • tests passes

@andehen andehen marked this pull request as ready for review February 6, 2025 12:21
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 in schema.py to support different metric types (count, continuous, funnel)
  • Introduced ExperimentEventMetricConfig and ExperimentDataWarehouseMetricConfig 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

# 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
Copy link
Contributor

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

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.

1 participant