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

Fix: Disable Telemetry when --no-version-updates flag is enabled in cliOptions #29635

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

toothlessdev
Copy link
Contributor

@toothlessdev toothlessdev commented Nov 17, 2024

Closes #29408

What I did

Add test code for disable withTelemetry when --no-version-updates flag is enabled in cliOptions
Disable Telemetry when --no-version-updates flag is enabled in cliOptions

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 78.4 MB 78.4 MB 3.53 kB -0.17 0%
initSize 144 MB 144 MB 3.62 kB -0.59 0%
diffSize 65.1 MB 65.1 MB 90 B -0.83 0%
buildSize 6.83 MB 6.83 MB 0 B -1.05 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB 0 B -1.09 0%
buildSbPreviewSize 271 kB 271 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.83 MB 3.83 MB 0 B -1.09 0%
buildPreviewSize 3 MB 3 MB 0 B 0.95 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 15.5s 24.7s 9.2s 1.12 37.3%
generateTime 19.4s 19.1s -272ms -0.62 -1.4%
initTime 13.3s 14.2s 863ms -0.35 6.1%
buildTime 7.7s 8.8s 1s -0.12 12%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.8s 5.5s -278ms -0.23 -5%
devManagerResponsive 3.5s 3.8s 331ms 1.01 8.5%
devManagerHeaderVisible 587ms 657ms 70ms 1.43 🔺10.7%
devManagerIndexVisible 668ms 683ms 15ms 0.59 2.2%
devStoryVisibleUncached 1.2s 1.4s 228ms 2.26 🔺15.5%
devStoryVisible 624ms 682ms 58ms 0.8 8.5%
devAutodocsVisible 542ms 375ms -167ms -2.63 🔰-44.5%
devMDXVisible 701ms 381ms -320ms -1.8 🔰-84%
buildManagerHeaderVisible 584ms 495ms -89ms -0.92 -18%
buildManagerIndexVisible 603ms 521ms -82ms -0.74 -15.7%
buildStoryVisible 583ms 489ms -94ms -0.98 -19.2%
buildAutodocsVisible 479ms 473ms -6ms 0.01 -1.3%
buildMDXVisible 478ms 414ms -64ms -0.72 -15.5%

Greptile Summary

This PR modifies Storybook's telemetry behavior to respect the --no-version-updates CLI flag, ensuring telemetry is disabled when version updates are disabled.

  • Added condition in code/core/src/core-server/withTelemetry.ts to disable telemetry when options.cliOptions.versionUpdates === false
  • Added test case in withTelemetry.test.ts to verify telemetry is not called when versionUpdates is false
  • Fixes issue [Bug]: Storybook telemetry is not disabled #29408 where telemetry was still active despite being explicitly disabled
  • Implementation aligns with existing telemetry disable options like disableTelemetry flag and STORYBOOK_DISABLE_TELEMETRY env var

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 141 to 145
const enableTelemetry = !(
options.cliOptions.disableTelemetry || options.cliOptions.test === true
options.cliOptions.disableTelemetry === true ||
options.cliOptions.test === true ||
options.cliOptions.versionUpdates === false
);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider extracting these conditions into a separate function for better readability and reusability, e.g. shouldEnableTelemetry(options)

Copy link

nx-cloud bot commented Nov 17, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 7b7e3a7. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@toothlessdev toothlessdev changed the title Fix: Disable Telementry when --no-version-updates flag is enabled in cliOptions Fix: Disable Telemetry when --no-version-updates flag is enabled in cliOptions Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Storybook telemetry is not disabled
3 participants