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

Stats: Add line chart for real-time stats prototype #99141

Merged
merged 13 commits into from
Feb 4, 2025

Conversation

kangzj
Copy link
Contributor

@kangzj kangzj commented Jan 31, 2025

Related to #

Proposed Changes

  • Add Automattic Chart Lib
  • Add a real-time traffic line chart with fake data refreshing every minute

Why are these changes being made?

  • PoC

Testing Instructions

  • Build and start locally yarn and then yarn start
  • Open http://calypso.localhost:3000/stats/realtime/jetpack.com
  • You can change the 60 * 1000 to just 1000 to see how it works
  • Ensure the code generally looks oaky

Important

Note: we need to async load all charts in the future as the package is relatively big ~300k.

Screen.Recording.2025-01-31.at.4.15.30.PM.mov

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@kangzj kangzj added [Feature] Stats Everything related to our analytics product at /stats/ DO NOT MERGE labels Jan 31, 2025
@kangzj kangzj requested a review from a8ck3n January 31, 2025 03:24
@kangzj kangzj self-assigned this Jan 31, 2025
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 31, 2025
@kangzj kangzj requested a review from a team January 31, 2025 03:24
@matticbot
Copy link
Contributor

matticbot commented Jan 31, 2025

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • blaze-dashboard
  • command-palette-wp-admin
  • help-center
  • notifications
  • odyssey-stats
  • whats-new
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/line-chart-for-real-time-tab on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented Jan 31, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~140 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
entry-main                  +395 B  (+0.0%)     +103 B  (+0.0%)
entry-stepper               +389 B  (+0.0%)     +105 B  (+0.0%)
entry-subscriptions         +341 B  (+0.0%)      +95 B  (+0.0%)
entry-login                 +323 B  (+0.0%)      +85 B  (+0.0%)
entry-domains-landing       +286 B  (+0.0%)      +75 B  (+0.0%)
entry-browsehappy           +286 B  (+0.1%)      +75 B  (+0.1%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~5435 bytes added 📈 [gzipped])

name                                parsed_size           gzip_size
patterns                               +13464 B  (+0.6%)    +4640 B  (+0.8%)
site-performance                        +1455 B  (+0.1%)     +436 B  (+0.1%)
performance-profiler                    +1449 B  (+0.4%)     +431 B  (+0.4%)
stats                                    +746 B  (+0.1%)      +69 B  (+0.0%)
comments                                 +120 B  (+0.0%)      +47 B  (+0.0%)
themes                                    +96 B  (+0.0%)      +34 B  (+0.0%)
theme                                     +96 B  (+0.0%)      +39 B  (+0.0%)
google-my-business                        +63 B  (+0.0%)      +23 B  (+0.0%)
plugins                                   +60 B  (+0.0%)      +38 B  (+0.0%)
media                                     +60 B  (+0.0%)      +30 B  (+0.0%)
reader                                    +54 B  (+0.0%)      +23 B  (+0.0%)
jetpack-cloud-plugin-management           +48 B  (+0.0%)      +30 B  (+0.0%)
hosting                                   +48 B  (+0.0%)      +18 B  (+0.0%)
home                                      +48 B  (+0.0%)      +25 B  (+0.0%)
domains                                   +48 B  (+0.0%)      +18 B  (+0.0%)
a8c-for-agencies-plugins                  +48 B  (+0.0%)      +30 B  (+0.0%)
settings-writing                          +42 B  (+0.0%)      +22 B  (+0.0%)
jetpack-connect                           +42 B  (+0.0%)      +13 B  (+0.0%)
write-flow                                +36 B  (+0.0%)      +13 B  (+0.0%)
site-overview                             +36 B  (+0.0%)      +17 B  (+0.0%)
promote-post-i2                           +36 B  (+0.0%)      +15 B  (+0.0%)
link-in-bio-tld-flow                      +36 B  (+0.0%)      +13 B  (+0.0%)
jetpack-cloud-agency-dashboard            +36 B  (+0.0%)      +15 B  (+0.0%)
build-flow                                +36 B  (+0.0%)      +13 B  (+0.0%)
a8c-for-agencies-sites                    +36 B  (+0.0%)      +17 B  (+0.0%)
settings-podcast                          +30 B  (+0.0%)      +15 B  (+0.0%)
settings-newsletter                       +30 B  (+0.0%)      +15 B  (+0.0%)
settings                                  +30 B  (+0.0%)      +21 B  (+0.0%)
email                                     +30 B  (+0.0%)      +11 B  (+0.0%)
backup                                    +30 B  (+0.0%)      +15 B  (+0.0%)
activity                                  +30 B  (+0.0%)      +15 B  (+0.0%)
staging-site                              +24 B  (+0.0%)      +14 B  (+0.0%)
sites-dashboard                           +24 B  (+0.0%)      +14 B  (+0.0%)
site-tools                                +24 B  (+0.0%)      +14 B  (+0.0%)
site-settings                             +24 B  (+0.0%)      +14 B  (+0.0%)
site-purchases                            +24 B  (+0.0%)      +12 B  (+0.0%)
site-profiler                             +24 B  (+0.0%)       +9 B  (+0.0%)
site-monitoring                           +24 B  (+0.0%)      +14 B  (+0.0%)
site-marketing                            +24 B  (+0.0%)      +14 B  (+0.0%)
site-logs                                 +24 B  (+0.0%)      +14 B  (+0.0%)
settings-security                         +24 B  (+0.0%)      +14 B  (+0.0%)
settings-performance                      +24 B  (+0.0%)      +14 B  (+0.0%)
settings-jetpack                          +24 B  (+0.0%)      +14 B  (+0.0%)
settings-discussion                       +24 B  (+0.0%)      +14 B  (+0.0%)
security                                  +24 B  (+0.0%)      +10 B  (+0.0%)
scan                                      +24 B  (+0.0%)      +14 B  (+0.0%)
purchases                                 +24 B  (+0.0%)      +12 B  (+0.0%)
preview                                   +24 B  (+0.0%)      +12 B  (+0.0%)
posts-custom                              +24 B  (+0.0%)      +14 B  (+0.0%)
posts                                     +24 B  (+0.0%)      +14 B  (+0.0%)
plans                                     +24 B  (+0.0%)      +14 B  (+0.0%)
people                                    +24 B  (+0.0%)      +15 B  (+0.0%)
pages                                     +24 B  (+0.0%)      +14 B  (+0.0%)
notification-settings                     +24 B  (+0.0%)       +9 B  (+0.0%)
marketing                                 +24 B  (+0.0%)      +14 B  (+0.0%)
jetpack-cloud-partner-portal              +24 B  (+0.0%)      +10 B  (+0.0%)
import-hosted-site-flow                   +24 B  (+0.0%)      +11 B  (+0.0%)
hosting-features                          +24 B  (+0.0%)      +14 B  (+0.0%)
github-deployments                        +24 B  (+0.0%)      +14 B  (+0.0%)
earn                                      +24 B  (+0.0%)      +18 B  (+0.0%)
account                                   +24 B  (+0.0%)       +8 B  (+0.0%)
woocommerce-installation                  +18 B  (+0.0%)      +10 B  (+0.0%)
woocommerce                               +18 B  (+0.0%)      +10 B  (+0.0%)
subscribers                               +18 B  (+0.0%)      +10 B  (+0.0%)
settings-reading                          +18 B  (+0.0%)      +10 B  (+0.0%)
migrate                                   +18 B  (+0.0%)      +10 B  (+0.0%)
marketplace                               +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-social                            +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-search                            +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-cloud-settings                    +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-cloud-pricing                     +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-cloud-overview                    +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-cloud-features-comparison         +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-cloud                             +18 B  (+0.0%)      +10 B  (+0.0%)
import                                    +18 B  (+0.0%)      +10 B  (+0.0%)
gutenberg-editor                          +18 B  (+0.0%)      +10 B  (+0.0%)
export                                    +18 B  (+0.0%)      +10 B  (+0.0%)
devdocs                                   +18 B  (+0.0%)       +4 B  (+0.0%)
customize                                 +18 B  (+0.0%)      +10 B  (+0.0%)
concierge                                 +18 B  (+0.0%)      +10 B  (+0.0%)
checkout                                  +18 B  (+0.0%)      +10 B  (+0.0%)
add-ons                                   +18 B  (+0.0%)      +10 B  (+0.0%)
accept-invite                             +18 B  (+0.0%)       +2 B  (+0.0%)
a8c-for-agencies-team                     +18 B  (+0.0%)       +5 B  (+0.0%)
a8c-for-agencies-settings                 +18 B  (+0.0%)       +8 B  (+0.0%)
a8c-for-agencies-referrals                +18 B  (+0.0%)       +8 B  (+0.0%)
a8c-for-agencies-purchases                +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies-partner-directory        +18 B  (+0.0%)       +8 B  (+0.0%)
a8c-for-agencies-overview                 +18 B  (+0.0%)       +8 B  (+0.0%)
a8c-for-agencies-migrations               +18 B  (+0.0%)       +8 B  (+0.0%)
a8c-for-agencies-marketplace              +18 B  (+0.0%)       +8 B  (+0.0%)
a8c-for-agencies-landing                  +18 B  (+0.0%)       +7 B  (+0.0%)
a8c-for-agencies-client                   +18 B  (+0.0%)       +8 B  (+0.0%)
a8c-for-agencies-agency-tier              +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies                          +18 B  (+0.0%)      +11 B  (+0.0%)
help                                      +12 B  (+0.0%)       +6 B  (+0.0%)
domain-user-transfer-flow                 +12 B  (+0.0%)       +2 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~75577 bytes added 📈 [gzipped])

name                                                                         parsed_size           gzip_size
async-load-calypso-my-sites-stats-components-line-chart                        +332828 B    (new)   +90437 B    (new)
async-load-comment-block-editor                                                 +13452 B  (+0.5%)    +4636 B  (+0.7%)
async-load-automattic-global-styles-src-components-global-styles-variations     +13452 B  (+0.7%)    +4636 B  (+0.9%)
async-load-calypso-my-sites-stats-pages-realtime                                  +467 B  (+5.1%)     +168 B  (+5.7%)
async-load-design-blocks                                                          +126 B  (+0.0%)      +49 B  (+0.0%)
async-load-signup-steps-theme-selection                                            +78 B  (+0.0%)      +24 B  (+0.0%)
async-load-design-playground                                                       +63 B  (+0.0%)      +22 B  (+0.0%)
async-load-design                                                                  +63 B  (+0.0%)      +22 B  (+0.0%)
async-load-calypso-post-editor-media-modal                                         +42 B  (+0.0%)      +20 B  (+0.0%)
async-load-calypso-post-editor-editor-media-modal                                  +42 B  (+0.0%)      +21 B  (+0.0%)
async-load-automattic-help-center-stepper                                          +24 B  (+0.0%)      +11 B  (+0.0%)
async-load-automattic-help-center                                                  +24 B  (+0.0%)      +13 B  (+0.0%)
async-load-store-app-store-stats                                                   +18 B  (+0.0%)      +10 B  (+0.0%)
async-load-signup-steps-user                                                       +18 B  (+0.0%)       +2 B  (+0.0%)
async-load-signup-steps-site-picker                                                +18 B  (+0.0%)       +7 B  (+0.0%)
async-load-signup-steps-p2-site                                                    +18 B  (+0.0%)       +1 B  (+0.0%)
async-load-signup-steps-difm-site-picker                                           +18 B  (+0.0%)       +7 B  (+0.0%)
async-load-calypso-components-web-preview-component                                +18 B  (+0.0%)       +7 B  (+0.0%)
async-load-calypso-components-jetpack-portal-nav                                   +18 B  (+0.0%)       +8 B  (+0.1%)
async-load-store-app-store-stats-listview                                          +12 B  (+0.0%)       +6 B  (+0.0%)
async-load-signup-steps-site                                                       +12 B  (+0.0%)       +1 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@kangzj kangzj force-pushed the add/line-chart-for-real-time-tab branch from fedf6b3 to 627e916 Compare February 4, 2025 02:19
@kangzj kangzj requested a review from annacmc February 4, 2025 02:44
@kangzj kangzj changed the title Try: Add line chart for real-time stats Stats: Add line chart for real-time stats prototype Feb 4, 2025
@kangzj kangzj marked this pull request as ready for review February 4, 2025 02:46
Copy link
Contributor

@dognose24 dognose24 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the line chart importing. We can move forward after resolving the failed Unit tests.

@kangzj kangzj merged commit d383bee into trunk Feb 4, 2025
11 of 13 checks passed
@kangzj kangzj deleted the add/line-chart-for-real-time-tab branch February 4, 2025 23:14
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 4, 2025
@a8ci18n
Copy link

a8ci18n commented Feb 5, 2025

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/17229261

Some locales (Hebrew, Japanese) have been temporarily machine-translated due to translator availability. All other translations are usually ready within a few days. Untranslated and machine-translated strings will be sent for translation next Monday and are expected to be completed by the following Friday.

Hi @kangzj, could you please edit the description of this PR and add a screenshot for our translators? Ideally it'd include all of the following strings:

  • Real-time views
  • Collecting data… auto-refreshing in a minute…

Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Stats Everything related to our analytics product at /stats/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants