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 4 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 77.7 MB 77.7 MB 0 B -0.46 0%
initSize 130 MB 130 MB 90 B -2 0%
diffSize 52.4 MB 52.4 MB 90 B -2 0%
buildSize 6.83 MB 6.83 MB 0 B 1.63 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B 0.49 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB 0 B 1.33 0%
buildSbPreviewSize 271 kB 271 kB 0 B 0.4 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.84 MB 3.84 MB 0 B 1.11 0%
buildPreviewSize 3 MB 3 MB 0 B 1.99 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.8s -6s -443ms -1 -94.3%
generateTime 26.5s 18.8s -7s -676ms -0.73 -40.8%
initTime 16.7s 12.5s -4s -184ms -0.72 -33.3%
buildTime 10.9s 8s -2s -830ms -1.05 -35%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 4.7s 6s 1.2s 0.25 21.1%
devManagerResponsive 3.3s 4.4s 1s 1.13 23.8%
devManagerHeaderVisible 599ms 536ms -63ms -0.4 -11.8%
devManagerIndexVisible 627ms 562ms -65ms -0.54 -11.6%
devStoryVisibleUncached 1.6s 1.6s 10ms 0.61 0.6%
devStoryVisible 626ms 561ms -65ms -0.51 -11.6%
devAutodocsVisible 575ms 479ms -96ms -0.36 -20%
devMDXVisible 565ms 519ms -46ms -0.18 -8.9%
buildManagerHeaderVisible 626ms 577ms -49ms -0.1 -8.5%
buildManagerIndexVisible 633ms 595ms -38ms -0.09 -6.4%
buildStoryVisible 619ms 576ms -43ms -0.08 -7.5%
buildAutodocsVisible 509ms 506ms -3ms 0.15 -0.6%
buildMDXVisible 530ms 492ms -38ms 0.07 -7.7%

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 4fc23c0. 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