Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Add performance tracks to onboarding flow #8042

Merged
merged 8 commits into from
Jan 24, 2022
Merged

Conversation

louwie17
Copy link
Contributor

@louwie17 louwie17 commented Dec 16, 2021

Fixes #7919

This adds one extra onboarding track for the business details free extensions step to add info about installation time.
Also adding one extra prop for the product types step as we sometime install WC Pay there.

Screenshots

Screen Shot 2021-12-16 at 4 31 30 PM

cc @pmcpinto & @becdetat I added a new track storeprofiler_store_business_features_installed_and_activated for the install time props, see the example above. Does this look ok, or would you prefer to tag it on to one of the existing tracks. I decided on a new track mostly to keep thinks semi clean and allowing for easy removal if we decide we don't want it anymore.

Detailed test instructions:

  • Start a fresh site and enable the console log for tracks -> localStorage.setItem( 'debug', 'wc-admin:*' );
  • Walk through the onboarding flow and make sure you select all or some of the free extensions
  • Once that step is finished it should show a new track called -> storeprofiler_store_business_features_installed_and_activated
  • This should include the install time for each selected plugin, install time is put in several time slots 0-2sec, 3-5sec, etc...
  • Now delete the installed plugins and enable this plugin (which causes Jetpack or Google Listings and Ads to fail)
  • Go through the onboarding again, making sure to have Jetpack or Google Listings and Ads selected
  • Notice how the step fails now and the track is still triggered, this time with success set to false and a failed_extensions list.

@pmcpinto
Copy link

cc @pmcpinto & @becdetat I added a new track storeprofiler_store_business_features_installed_and_activated for the install time props, see the example above. Does this look ok, or would you prefer to tag it on to one of the existing tracks. I decided on a new track mostly to keep thinks semi clean and allowing for easy removal if we decide we don't want it anymore.

Adding a new track sounds good to me. When do you plan to release this? WC 6.0?

@louwie17
Copy link
Contributor Author

Adding a new track sounds good to me. When do you plan to release this? WC 6.0?

This would be part of 6.2 I believe, as it would be in WCA 3.1, given we already cut the RC version of 3.0.

@louwie17 louwie17 requested a review from a team December 17, 2021 12:59
Copy link
Contributor

@joshuatf joshuatf left a comment

Choose a reason for hiding this comment

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

Great work, @louwie17! Left a couple minor comments, but nothing really blocking depending on your thoughts on them.

@@ -59,27 +59,81 @@ export const filterBusinessExtensions = ( extensionInstallationOptions ) => {
);
};

const timeBoxes = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Timebox is an interesting name. Not super opinionated on this, but maybe timeFrames?

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 here: 8ca96a0

{ name: '10-15s', max: 15 },
{ name: '>15s' },
];
function getTimebox( timeInMs ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

A couple quick tests around this would be really awesome.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I added them here: 8ca96a0

Copy link
Contributor

Choose a reason for hiding this comment

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

Could optionally also rename to getTimeFrame to keep these consisten.

const key =
fieldKey === 'woocommerce-payments'
? 'wcpay'
: `${ fieldKey.replace( /-/g, '_' ) }`.split( ':', 1 )[ 0 ];
Copy link
Contributor

Choose a reason for hiding this comment

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

We're doing this enough that it may warrant a shared util or some sanitization on the backend even before hitting components, but not a blocker for this PR.

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 here, thanks for the suggestion: cbf184d

$upgrader = new \Plugin_Upgrader( new \Automatic_Upgrader_Skin() );
$result = $upgrader->install( $api->download_link );
$results[ $plugin ] = $result;
$install_time[ $plugin ] = round( ( microtime( true ) - $start_time ) * 1000 );
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 💯

@joshuatf joshuatf added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed status: needs review labels Dec 20, 2021
@louwie17
Copy link
Contributor Author

@joshuatf thanks for the review, I updated this PR with your feedback, it should be ready for a re-review.

@louwie17 louwie17 added status: needs review and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Dec 21, 2021
Copy link
Contributor

@joshuatf joshuatf left a comment

Choose a reason for hiding this comment

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

Hey @louwie17- thanks for the changes!

Had a couple more thoughts on this that I left below.

@@ -45,7 +46,7 @@ describe( 'BusinessDetails', () => {
jetpack: false,
'google-listings-and-ads': true,
'mailchimp-for-woocommerce': false,
'woocommerce-payments': true,
'woocommerce-payments:us': true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Good thinking 👍

{ name: '10-15s', max: 15 },
{ name: '>15s' },
];
function getTimebox( timeInMs ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could optionally also rename to getTimeFrame to keep these consisten.

@@ -0,0 +1,12 @@
export function getPluginSlug( id: string ): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice sharing this as utils!

I think it would be great to handle this entirely server-side at some point, but this is a great short-term solution.

for ( let [ fieldKey ] of Object.entries( extensionInstallationOptions ) ) {
fieldKey = getPluginSlug( fieldKey );
const key = getPluginTrackKey( fieldKey );
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this condition is not passing for me. I'm not getting installation data or times in the latest version.

Screen Shot 2021-12-27 at 3 09 45 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joshuatf is this because these plugins were already installed and just needed to be activated?
This condition is triggered for me, when an installation is required (this does depend on changes in the data package, so maybe that didn't get updated?)

Copy link
Contributor

Choose a reason for hiding this comment

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

That was with plugins completely removed. I can try again later today and rebuild all packages to see if that makes a difference.

{ name: '2-5s', max: 5 },
{ name: '5-10s', max: 10 },
{ name: '10-15s', max: 15 },
{ name: '>15s' },
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for not mentioning this earlier, but I wonder if these timeframes should be stretched out a bit. I think 99% of first-time installers are going to be in the 15s+ range. cc @pmcpinto @becdetat

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 added several more time frames all the way up to >60s, I would be quite concerned if we hit the >60s often (I could even stop at >30s)

);

recordEvent(
'storeprofiler_store_business_features_installed_and_activated',
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noting that Google and WCPay will always be listed here with the current logic, even when they are already installed/activated. Not sure if that will be misleading with the data since the timeframes will be shorter.
Screen Shot 2021-12-27 at 3 00 43 PM

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 updated the logic, so we don't call the install and activate hook when all the selected extensions are already activated and installed. This will prevent the above scenario. The changes for this are here: 6e47c4c

@joshuatf joshuatf added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed status: needs review labels Dec 27, 2021
@louwie17
Copy link
Contributor Author

@joshuatf this will be ready for a re-review whenever you have time, or of-course anyone else on @woocommerce/mothra .

@louwie17 louwie17 added status: needs review and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Jan 10, 2022
Copy link
Contributor

@joshuatf joshuatf left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, @louwie17!

This looks good and is testing well in my environments. Most seemed to come in between 20-40s so i think the timeframes are adequate coverage.

@louwie17 louwie17 merged commit 1d0a3cd into main Jan 24, 2022
@louwie17 louwie17 deleted the add/7919_performance_tracks branch January 24, 2022 16:23
ObliviousHarmony pushed a commit to woocommerce/woocommerce that referenced this pull request Mar 18, 2022
…min#8042)

* Add payment_setup track for WooCommerce Payments

* Add timing props to tracks in onboarding when installing extensions

* Update extension key logic

* Add changelog

* Add tests for extension installation data for tracks

* Add util function for plugin slug parsing

* Only install and activate plugins that are not already active
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store profiler: Track extensions installation performance and failures
3 participants