8000 Aggregate stat service by alanhartless · Pull Request #9757 · mautic/mautic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Aggregate stat service #9757

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

Merged
merged 74 commits into from
Mar 29, 2021

Conversation

alanhartless
Copy link
Contributor
@alanhartless alanhartless commented Mar 8, 2021
Q A
Branch? "features"
Bug fix? no
New feature? yes
Deprecations? no
BC breaks? no
Automated tests included? yes
Related user documentation PR URL na
Related developer documentation PR URL
Issue(s) addressed

This adds the service to use a new event to collect stats to allow 3rd party to manage and inject stats. The email graph's TEMPLATE graph has been rewritten to use it. Note that a lot of the statistic collection for the email was refactored into individual classes an are not necessarily part of the example for how to use the service.

(Note this PR is a blocker to Acquia contributing a number of PRs as code changed depends on this code).

https://github.com/mautic/mautic/pull/9757/files#diff-a9a319bd79a694d0b73f80b6ceb80b383601bd77b0d943890d35eb5275f1d6b8R65 demonstrates how to dispatch a request to collect a specific set of stats (by hour) and formats it for whatever its purpose is. In this case, it's the data for chart.js.

https://github.com/mautic/mautic/pull/9757/files#diff-20b8dee755b891bca4995d9bfe8f2d065b0ec8577261fda99bc1fec627eea70dR44 listens to the event dispatched by the collector service.

https://github.com/mautic/mautic/pull/9757/files#diff-a9a319bd79a694d0b73f80b6ceb80b383601bd77b0d943890d35eb5275f1d6b8R145 injects the stats into the StatCollection.

To test this PR for the email graph,

  1. create a template email.
  2. create a campaign to send that email to some contacts.
  3. Open some of the emails, click on the links in some of the emails, and unsubscribe from one of the emails.
  4. View the email details page to see if the stats are legit.

@cla-bot cla-bot bot added the cla-signed The PR contributors have signed the contributors agreement label Mar 8, 2021
@codecov
Copy link
codecov bot commented Mar 8, 2021

Codecov Report

Merging #9757 (85f8624) into features (07cd6b4) will increase coverage by 0.02%.
The diff coverage is 38.03%.

Impacted file tree graph

@@              Coverage Diff               @@
##             features    #9757      +/-   ##
==============================================
+ Coverage       39.67%   39.70%   +0.02%     
- Complexity      33978    34163     +185     
==============================================
  Files            1989     2016      +27     
  Lines          105731   106275     +544     
==============================================
+ Hits            41951    42192     +241     
- Misses          63780    64083     +303     
Impacted Files Coverage Δ Complexity Δ
.../bundles/CoreBundle/Helper/Chart/AbstractChart.php 72.72% <ø> (-2.86%) 23.00 <0.00> (-11.00)
...ailBundle/Controller/EmailGraphStatsController.php 0.00% <ø> (ø) 8.00 <0.00> (ø)
...mailBundle/Stats/FetchOptions/EmailStatOptions.php 0.00% <0.00%> (ø) 14.00 <14.00> (?)
...p/bundles/EmailBundle/Stats/Helper/FilterTrait.php 0.00% <0.00%> (ø) 12.00 <12.00> (?)
...bundles/StatsBundle/Event/Options/FetchOptions.php 0.00% <0.00%> (ø) 5.00 <5.00> (?)
app/bundles/EmailBundle/Model/EmailModel.php 32.87% <3.03%> (+1.79%) 319.00 <18.00> (-24.00) ⬆️
...bundles/EmailBundle/Stats/Helper/ClickedHelper.php 9.52% <9.52%> (ø) 4.00 <4.00> (?)
...undles/EmailBundle/Stats/Helper/AbstractHelper.php 10.20% <10.20%> (ø) 16.00 <16.00> (?)
...bundles/EmailBundle/Stats/Helper/BouncedHelper.php 11.76% <11.76%> (ø) 3.00 <3.00> (?)
...es/EmailBundle/Stats/Helper/UnsubscribedHelper.php 11.76% <11.76%> (ø) 3.00 <3.00> (?)
... and 48 more

@kuzmany
Copy link
Member
kuzmany commented Mar 8, 2021

@alanhartless can you point the lines with dispatcher again? Now does not show the right lines

@RCheesley RCheesley added feature A new feature for inclusion in minor or major releases reports Anything related to reports T3 Hard difficulty to fix (issue) or test (PR) labels Mar 8, 2021
@RCheesley RCheesley added this to the Mautic 4.0 milestone Mar 8, 2021
@RCheesley RCheesley changed the title Aggretate stat service Aggregate stat service Mar 8, 2021
@alanhartless
Copy link
Contributor Author

@alanhartless can you point the lines with dispatcher again? Now does not show the right lines

@kuzmany updated

kuzmany
kuzmany previously approved these changes Mar 9, 2021
Copy link
Member
@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

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

I've checked the code and looks very nice. I also made some basic tests on emails stats and works properly.
I'm exited to see it in core.
Unit test included.
Count Acquia use it in production.
Then we can merge it :

@RCheesley RCheesley added the has-conflicts Pull requests that cannot be merged until conflicts have been resolved label Mar 28, 2021
alanhartless and others added 23 commits March 28, 2021 11:13
update phpdoc year

Co-Authored-By: galvani <galvani78@gmail.com>
Deleting file in "unit" to be re-added under "Unit" (aggravating case insensitive filesystem)
Copy link
Member
@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

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

Based on the +1 from @kuzmany and that Acquia has this in production, LGTM! 🚀

@RCheesley RCheesley added the ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged label Mar 28, 2021
@RCheesley RCheesley merged commit 489b00d into mautic:features Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The PR contributors have signed the contributors agreement feature A new feature for inclusion in minor or major releases has-conflicts Pull requests that cannot be merged until conflicts have been resolved ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged reports Anything related to reports T3 Hard difficulty to fix (issue) or test (PR)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0