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(platform-stats): provide number of recently created wikis and users #617

Merged
merged 13 commits into from
Jul 5, 2023

Conversation

m90
Copy link
Contributor

@m90 m90 commented Jun 28, 2023

Ticket https://phabricator.wikimedia.org/T335961

This provides any configured number of additional metrics from the PlatformStatsJob. Ranges are added by passing a valid TimeInterval string to WBSTACK_SUMMARY_CREATION_RATE_RANGES.

@m90 m90 force-pushed the fr/signup-rate branch 10 times, most recently from 14a0366 to f2eef36 Compare June 28, 2023 09:45
@m90 m90 changed the title feat(platform-stats): provide number of recently created wikis feat(platform-stats): provide number of recently created wikis and users Jun 29, 2023
@m90 m90 force-pushed the fr/signup-rate branch 9 times, most recently from e6403f8 to 1e7a363 Compare June 29, 2023 12:32
@m90 m90 force-pushed the fr/signup-rate branch 2 times, most recently from 294624f to 2077e1b Compare July 3, 2023 08:07
@m90 m90 force-pushed the fr/signup-rate branch 9 times, most recently from 9c18466 to fd20ae3 Compare July 3, 2023 10:07
@m90 m90 force-pushed the fr/signup-rate branch 4 times, most recently from 47bb54b to d7c86a2 Compare July 3, 2023 12:08
@m90 m90 force-pushed the fr/signup-rate branch 2 times, most recently from af7463e to ab41cb5 Compare July 3, 2023 12:29
Comment on lines +38 to +41
Wiki::query()->delete();
User::query()->delete();
WikiManager::query()->delete();
WikiDb::query()->delete();
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'm not entirely sure why this is still needed when RefreshDatabase is used. If it's not there, each test in this suite will see items created by its preceding siblings.

Copy link
Contributor

@deer-wmde deer-wmde Jul 3, 2023

Choose a reason for hiding this comment

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

This sounds familiar - I think that even may be the reason why we have this target in the Makefile to run tests with a clean database https://github.com/wbstack/api/blob/main/Makefile#L11

(I'm not trying to say this is a good thing - something doesn't seem to work there)

edit: nevermind, I think that was introduced for a different case (running the same test again, not several tests in the same test case)

Copy link
Contributor

Choose a reason for hiding this comment

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

I found another trait called DatabaseMigrations: https://laravel.com/docs/8.x/dusk#migrations

It seems we don't need the extended tearDown method when using this trait. (at least the test completes successfully repeatedly with it for me)

I'm not 100% certain this is the right thing to do, as I found this in a browser automation testing section in the laravel docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what Dusk even is? It might be worth spending some time in removing all statefulness from all tests at some point. It's kind of suboptimal this bites me every single time I add a feature and spend a lot of time debugging why my new test now breaks another test. Ideally, we could even aim for having the tests run using an in-memory database so that we can just run them locally without a database proper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There has been work on this here #559 but I'm not sure why it was abandoned.

Copy link
Contributor

@deer-wmde deer-wmde left a comment

Choose a reason for hiding this comment

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

In general this looks great to me - as a last step I will try if it works as intended on my local cluster

edit: yay!

[2023-07-03 15:37:17][NwaQTIMNzJXupYp4IsLALN8lYpprPOwe] Processing: App\Jobs\PlatformStatsSummaryJob
{"platform_summary_version":"v1","total":1,"deleted":0,"active":0,"inactive":0,"empty":1,"total_non_deleted_users":0,"total_non_deleted_active_users":0,"total_non_deleted_pages":0,"total_non_deleted_edits":0,"wikis_created_PT24H":1,"users_created_PT24H":1,"wikis_created_P30D":1,"users_created_P30D":1}
[2023-07-03 15:37:18][NwaQTIMNzJXupYp4IsLALN8lYpprPOwe] Processed:  App\Jobs\PlatformStatsSummaryJob

config/wbstack.php Outdated Show resolved Hide resolved
phpunit.xml Show resolved Hide resolved
Comment on lines +38 to +41
Wiki::query()->delete();
User::query()->delete();
WikiManager::query()->delete();
WikiDb::query()->delete();
Copy link
Contributor

Choose a reason for hiding this comment

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

I found another trait called DatabaseMigrations: https://laravel.com/docs/8.x/dusk#migrations

It seems we don't need the extended tearDown method when using this trait. (at least the test completes successfully repeatedly with it for me)

I'm not 100% certain this is the right thing to do, as I found this in a browser automation testing section in the laravel docs.

@m90 m90 merged commit 23907d4 into main Jul 5, 2023
5 checks passed
@m90 m90 deleted the fr/signup-rate branch July 5, 2023 07:45
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.

2 participants