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 1 commit 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.5 MB 78.5 MB 0 B 1.11 0%
initSize 144 MB 144 MB -997 B 1.1 0%
diffSize 65.2 MB 65.2 MB -997 B 0.8 0%
buildSize 6.87 MB 6.87 MB 0 B -1.1 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.9 MB 1.9 MB 0 B 0.97 0%
buildSbPreviewSize 271 kB 271 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.88 MB 3.88 MB 0 B 0.97 0%
buildPreviewSize 2.99 MB 2.99 MB 0 B -1.11 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 13.2s 6.7s -6s -598ms -1.11 -98.5%
generateTime 35.1s 19.8s -15s -302ms -0.57 -77.3%
initTime 15.3s 13.3s -2s -20ms -1.18 -15.1%
buildTime 8.8s 8.8s -45ms 0.11 -0.5%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6s 5.6s -419ms -0.03 -7.4%
devManagerResponsive 3.7s 3.4s -255ms -0.23 -7.4%
devManagerHeaderVisible 513ms 521ms 8ms -0.5 1.5%
devManagerIndexVisible 580ms 546ms -34ms -0.89 -6.2%
devStoryVisibleUncached 932ms 935ms 3ms -0.37 0.3%
devStoryVisible 547ms 545ms -2ms -0.86 -0.4%
devAutodocsVisible 540ms 469ms -71ms -0.69 -15.1%
devMDXVisible 515ms 452ms -63ms -0.81 -13.9%
buildManagerHeaderVisible 567ms 492ms -75ms -1.02 -15.2%
buildManagerIndexVisible 577ms 506ms -71ms -1.03 -14%
buildStoryVisible 565ms 494ms -71ms -0.98 -14.4%
buildAutodocsVisible 456ms 411ms -45ms -1.2 -10.9%
buildMDXVisible 412ms 403ms -9ms -0.66 -2.2%

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 2c2f352. 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