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

LG-15559: Add support for A/B tests daily reporting #11835

Merged
merged 16 commits into from
Feb 6, 2025

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Feb 3, 2025

🎫 Ticket

LG-15559

🛠 Summary of changes

Adds the ability to generate email reports for A/B test results to be sent to a team contact email on a regular basis.

This is intended to help:

  • Ensure accountability to create queries ahead of an A/B test being active in production, to guarantee that we're able to produce usable analytics for the test
  • Reduce manual engineer effort to actively monitor an A/B test after a few hours and on subsequent days of a test being active to make sure that the data being reported is in line with expected values
  • Be able to report data directly to relevant stakeholders automatically without additional involvement from an engineer
  • Improve visibility of ongoing A/B test progress to an entire team and other stakeholders

📜 Testing Plan

End-to-end testing is difficult, but you can verify that the report generates with expected tabular data with AWS-authenticated manual script execution.

Example:

$ aws-vault exec sandbox-readonly -- rails c
require 'reporting/ab_tests_report'
query = AbTest::ReportQueryConfig.new(
  title: 'Sign in success rate by mobile',
  query: "fields properties.browser_mobile as `Device` " \
         "| filter name = 'Email and Password Authentication' " \
         "| stats avg(properties.event_properties.success) as `Success Percent` by `Device` " \
         "| sort `Device`",
  row_labels: ['Mobile', 'Desktop'],
)
report = Reporting::AbTestsReport.new(
  queries: [query],
  time_range: Time.zone.now.yesterday..Time.zone.now,
)
report.send(:cloudwatch_client).instance_variable_set(:@log_group_name, 'int_/srv/idp/shared/log/events.log')
report.as_tables
# Example:
# [[["Device", "Success Percent"], ["Mobile", "0.80%"], ["Desktop", "0.60%"]]]

Observe:

  • Returned fields as table columns
  • Customizable row labels (first cell)
  • Table columns including "percent" are formatted as percentages

Verify that running the job class's perform method does not produce any errors. There are currently on A/B tests configured to use this feature, so no queries should be expected to be run.

$ rails c
Reports::AbTestsReport.new.perform(Time.zone.now)
# []

changelog: Internal, A/B Tests, Add support for A/B tests daily reporting
@aduth aduth marked this pull request as ready for review February 5, 2025 15:44
Copy link
Contributor

@matthinz matthinz left a comment

Choose a reason for hiding this comment

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

This is super cool!

@aduth aduth merged commit 9bd1067 into main Feb 6, 2025
2 checks passed
@aduth aduth deleted the aduth-lg-15559-ab-test-emails branch February 6, 2025 16:56
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