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): support multiple primary metrics #26899

Merged
merged 20 commits into from
Dec 19, 2024

Conversation

jurajmajerik
Copy link
Contributor

@jurajmajerik jurajmajerik commented Dec 13, 2024

Changes

Support adding/editing/deleting multiple primary metrics + new visualizations.

This is still behind the feature flag and needs more work before rolling out.

Initial state
image

Primary metrics populated + "no results" diagnostics"
image

Unexpected error
image

Dark mode
image

How did you test this code?

👀

@jurajmajerik jurajmajerik marked this pull request as draft December 13, 2024 14:03
Copy link
Contributor

github-actions bot commented Dec 14, 2024

Size Change: 0 B

Total Size: 1.11 MB

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

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@jurajmajerik jurajmajerik marked this pull request as ready for review December 17, 2024 11:56
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@jurajmajerik jurajmajerik requested a review from a team December 17, 2024 11:58
Copy link
Contributor

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

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

Looks like a good start!

No blocking comments on my part, other than it seems like we might want to put this behind a feature flag.

const cRate = conversionRateForVariant(result, 'control')
return vRate && cRate ? (vRate - cRate) / cRate : 0
})
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this math have some tests? The expected behavior isn't super obvious at surface level, so might be good to have some assertions to document intent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've reworked this so the above section has been completely removed.

I've thought more about how the bars should be colored and also checked how our competitors handle this. It turns out that coloring the best bar green doesn’t always make sense, because even the best variant might be entirely in the negative values!

Instead, similar Bayesian tools color the portions of the bar in negative values red and those in positive values green. Here’s how it looks now:

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Here’s how it looks now:

Cool 😄 Worth updating the PR description accordingly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -49,6 +50,7 @@ const ResultsTab = (): JSX.Element => {
)}
</>
)}
<MetricsView />
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you planning to load this behind a feature flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, forgot to push my last commit 🙈

) : (
<LemonTag size="small" type="danger" className="ml-1">
Error
</LemonTag>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd expect to see this label appear to the left of the text:

CleanShot 2024-12-17 at 12 54 32@2x

Interestingly, no results appear even though they're appearing on my experiment:

CleanShot 2024-12-17 at 12 55 35@2x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, what does Error show on hover?

Copy link
Contributor Author

@jurajmajerik jurajmajerik Dec 18, 2024

Choose a reason for hiding this comment

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

I think I'd expect to see this label appear to the left of the text

Done!

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, what does Error show on hover?

I don't see the Error right now but I'm seeing an empty tooltip for "Waiting for experiment to start..."

CleanShot 2024-12-18 at 07 10 25@2x

: undefined
}
>
Add metric
Copy link
Contributor

Choose a reason for hiding this comment

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

If I add a Trends metric as a second primary metric, how do I specify the exposure event?

CleanShot 2024-12-17 at 12 58 42@2x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add this in a follow up 👍

@jurajmajerik
Copy link
Contributor Author

@danielbachhuber I've addressed your comments, please have one more look.

I've also created an issue to track the todo's before rolling this out: #27014

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@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 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

</div>
</div>
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like these could use a little more padding:

CleanShot 2024-12-18 at 07 08 31@2x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

) : (
<LemonTag size="small" type="danger" className="ml-1">
Error
</LemonTag>
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, what does Error show on hover?

I don't see the Error right now but I'm seeing an empty tooltip for "Waiting for experiment to start..."

CleanShot 2024-12-18 at 07 10 25@2x

// eslint-disable-next-line react/forbid-dom-props
style={{ fontSize: '10px', fontWeight: 400 }}
>
<span>Results loading...</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<span>Results loading...</span>
<span>Results loading&hellip;</span>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see the Error right now but I'm seeing an empty tooltip for "Waiting for experiment to start..."

Good catch, fixed.

@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 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@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 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@jurajmajerik jurajmajerik merged commit fba447a into master Dec 19, 2024
97 of 98 checks passed
@jurajmajerik jurajmajerik deleted the experiments-primary-metrics branch December 19, 2024 09:59
@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 (wasn't pushed!)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

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