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

AA test for Search Results #3053

Merged
merged 1 commit into from
Jul 18, 2023
Merged

AA test for Search Results #3053

merged 1 commit into from
Jul 18, 2023

Conversation

Rosa-Fox
Copy link
Contributor

@Rosa-Fox Rosa-Fox commented May 10, 2023

Trello

The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

This test is only applied to /search/all results, not to finder search results.

Manual testing using Postman on /search/all for the different variants

Screenshot 2023-07-03 at 16 25 43 Screenshot 2023-07-03 at 16 25 19 Screenshot 2023-07-03 at 16 25 00

A finder search results page, which the test is not applied to:

Screenshot 2023-07-04 at 12 26 26

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3053 May 10, 2023 10:59 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3053 May 10, 2023 11:00 Inactive
Rosa-Fox added a commit to alphagov/govuk-cdn-config that referenced this pull request May 10, 2023
The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

Rendering app PR: alphagov/finder-frontend#3053
Rosa-Fox added a commit to alphagov/govuk-cdn-config that referenced this pull request May 31, 2023
The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

Rendering app PR: alphagov/finder-frontend#3053
Rosa-Fox added a commit to alphagov/govuk-cdn-config that referenced this pull request Jul 3, 2023
The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

Rendering app PR: alphagov/finder-frontend#3053
Copy link
Contributor

@sihugh sihugh left a comment

Choose a reason for hiding this comment

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

As Leena mentioned, convention is to put the controller parts of the config in a concern. This test doesn't have any logic though, so it's probably OK. You might want the practise!

@@ -8,6 +8,16 @@ class FindersController < ApplicationController
def show
slimmer_template "gem_layout_full_width" if i_am_a_topic_page_finder

ab_test = GovukAbTesting::AbTest.new(
Copy link
Contributor

Choose a reason for hiding this comment

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

The AB test will run on every page shown by this action, which might not be desired if K&C just want results from /search/all.
You could add a page_under_test? method that tests whether the path is /search/all, and wrap this logic in that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I checked with them and they only want it on /search/all... which makes sense as this is what they will want to test with the real AB test! Thanks for flagging. I have updated it to use the constraint.

@@ -66,6 +66,10 @@
<% end %>
</div>

<% content_for :meta_tags do %>
<%= @requested_variant.analytics_meta_tag.html_safe %>
Copy link
Contributor

Choose a reason for hiding this comment

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

if you do add a page_under_test? method, you'd need to wrap this bit in it too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

"EsSixPointSeven",
dimension: 1,
allowed_variants: %w[A B Z],
control_variant: "Z",
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@Rosa-Fox Rosa-Fox force-pushed the aa-test-es-6.7 branch 3 times, most recently from ca70d08 to ea30764 Compare July 4, 2023 11:37
Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

I think this looks ok. I've added a couple of suggestions for keeping the AB test code out of controller. I pretty much "borrowed" all suggestions from Kelvin 😅

@@ -353,4 +359,8 @@ def filter_query_array(arr)
arr.reject { |v| v == "all" }.compact.presence
end
end

def page_under_test?
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 this can be moved to the concern?

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!

Comment on lines 12 to 15
if page_under_test?
@requested_variant = elastic_search_aa_test.requested_variant(request.headers)
@requested_variant.configure_response(response)
end

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 all of this can be moved to the concern too, to keep the controller tidy.

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!

@Rosa-Fox
Copy link
Contributor Author

Thanks for the suggestions @leenagupte. I have fixed up :)

Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

This looks good. The concern is really nice.

I have one comment because I'm a bit confused by one of the tests.

expect(response.body).to include("EsSixPointSeven:#{variant}")
end

it "doesn't render the #{variant} for finders" do
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

end
end

it "should render the page without an AB test variant for search" do
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I follow how this test is different from "renders the #{variant} variant for /search/all pages". Is it because the variant is not being passed in the header? But the Vary header is still being set?

Copy link
Contributor Author

@Rosa-Fox Rosa-Fox Jul 12, 2023

Choose a reason for hiding this comment

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

yeah, tbh this was more out of paranoia to test that the page would still render if something went wrong with setting the variant, but its probably not needed as it should work!

@Rosa-Fox Rosa-Fox force-pushed the aa-test-es-6.7 branch 3 times, most recently from 38587e2 to a2000d2 Compare July 13, 2023 13:22
Rosa-Fox added a commit to alphagov/govuk-cdn-config that referenced this pull request Jul 13, 2023
The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

Rendering app PR: alphagov/finder-frontend#3053
The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

This test is only applied to /search/all results, not to finder search results.
@Rosa-Fox Rosa-Fox changed the title WIP - AA test for Search Results AA test for Search Results Jul 17, 2023
@Rosa-Fox Rosa-Fox marked this pull request as ready for review July 17, 2023 09:51
Copy link
Contributor

@gclssvglx gclssvglx left a comment

Choose a reason for hiding this comment

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

Looks great - thanks Rosa 👍

@Rosa-Fox Rosa-Fox merged commit 3f11092 into main Jul 18, 2023
7 checks passed
@Rosa-Fox Rosa-Fox deleted the aa-test-es-6.7 branch July 18, 2023 13:29
Rosa-Fox added a commit that referenced this pull request Jul 27, 2023
Removing this code as the AA test has been run.

There is however a chance that we will run a throttled version of the same test in a few weeks...
Given that it is being removed from the CDN config, I also decided to fully
remove the configuration from here, as it will be quick enough to bring it back again in
a few weeks if required.

PR to implment the AA test config: #3053
@Rosa-Fox Rosa-Fox mentioned this pull request Jul 27, 2023
Rosa-Fox added a commit that referenced this pull request Aug 16, 2023
We recently ran an AA test for the Search team (#3053).

We are going to run it again, hence reinstating it in this PR!

The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

This time around, the code will stay the same. We will use the same custom dimension and the variant split will still be 50/50. The only difference is that the custom dimension has been scoped as ‘user' as opposed to ‘session’ like it was last time. Scoping the custom dimension has already been done by a performance analyst.

We plan to deploy this on Thursday 17 August for 1 week.
Rosa-Fox added a commit that referenced this pull request Aug 16, 2023
We recently ran an AA test for the Search team (#3053).

We are going to run it again, hence reinstating it in this PR!

The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

This time around, the code will stay the same. We will use the same custom dimension and the variant split will still be 50/50. The only difference is that the custom dimension has been scoped as ‘user' as opposed to ‘session’ like it was last time. Scoping the custom dimension has already been done by a performance analyst.

We plan to deploy this on Thursday 17 August for 1 week.
Rosa-Fox added a commit that referenced this pull request Aug 16, 2023
We recently ran an AA test for the Search team (#3053).

We are going to run it again, hence reinstating it in this PR!

The purpose of the A/A test is to test the % of allocation of traffic/sample population based on the current version of elastic (6.7) against itself. A (ES 6.7) vs A (ES6.7). The A/A is solely to identify how the approach allocates traffic. This will provide benchmark data to aid analysis in future AA tests.

This time around, the code will stay the same. We will use the same custom dimension and the variant split will still be 50/50. The only difference is that the custom dimension has been scoped as ‘user' as opposed to ‘session’ like it was last time. Scoping the custom dimension has already been done by a performance analyst.

We plan to deploy this on Thursday 17 August for 1 week.
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.

5 participants