8000 Telemetry: Improve anonymous id calculation by tmeasday · Pull Request #29736 · storybookjs/storybook · GitHub
[go: up one dir, main page]

Skip to content

Telemetry: Improve anonymous id calculation #29736

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 4 commits into from
Dec 2, 2024
Merged

Conversation

tmeasday
Copy link
Member
@tmeasday tmeasday commented Nov 29, 2024
  • Paths were not stable between windows + unix
  • Remote URLs can be specified without the .git extension

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 pull request has been released as version 0.0.0-pr-29736-sha-1cc488e7. Try it out in a new sandbox by running npx storybook@0.0.0-pr-29736-sha-1cc488e7 sandbox or in an existing project with npx storybook@0.0.0-pr-29736-sha-1cc488e7 upgrade.

More information
Published version 0.0.0-pr-29736-sha-1cc488e7
Triggered by @tmeasday
Repository storybookjs/storybook
Branch tmeasday/anonymous-id-tweaks
Commit 1cc488e7
Datetime Fri Nov 29 03:14:35 UTC 2024 (1732850075)
Workflow run 12078375772

To request a new release of this pull request, mention the @storybookjs/core team.

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

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.7 MB 77.7 MB 222 B -0.61 0%
initSize 130 MB 130 MB 767 B -2.99 0%
diffSize 52.4 MB 52.4 MB 545 B -3 0%
buildSize 6.83 MB 6.83 MB 59 B 1.91 0%
buildSbAddonsSize 1.51 MB 1.51 MB 36 B 0.86 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB 0 B 1.11 0%
buildSbPreviewSize 271 kB 271 kB 23 B 0.76 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.84 MB 3.84 MB 59 B 1.05 0%
buildPreviewSize 3 MB 3 MB 0 B 2.98 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 8.7s 17.5s 8.8s 0.32 50.4%
generateTime 28.8s 19.7s -9s -149ms -0.47 -46.4%
initTime 19.7s 15.6s -4s -95ms 0 -26.2%
buildTime 10s 8.7s -1s -234ms -0.15 -14%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 4.4s 5.1s 708ms -0.59 13.7%
devManagerResponsive 3.3s 3.8s 548ms 0.25 14.2%
devManagerHeaderVisible 539ms 532ms -7ms -0.47 -1.3%
devManagerIndexVisible 601ms 590ms -11ms -0.45 -1.9%
devStoryVisibleUncached 1.7s 1.8s 65ms 0.98 3.5%
devStoryVisible 566ms 559ms -7ms -0.55 -1.3%
devAutodocsVisible 493ms 604ms 111ms 0.33 18.4%
devMDXVisible 482ms 609ms 127ms 0.19 20.9%
buildManagerHeaderVisible 476ms 523ms 47ms -0.38 9%
buildManagerIndexVisible 486ms 545ms 59ms -0.36 10.8%
buildStoryVisible 470ms 522ms 52ms -0.38 10%
buildAutodocsVisible 417ms 449ms 32ms -0.3 7.1%
buildMDXVisible 387ms 424ms 37ms -0.41 8.7%

Greptile Summary

Improved anonymous ID calculation in Storybook's telemetry by normalizing paths across operating systems and standardizing git remote URL handling.

  • Added path normalization using slash library in code/core/src/telemetry/anonymous-id.ts for consistent IDs between Windows and Unix
  • Added automatic .git extension appending in normalizeGitUrl() for remote URLs missing the extension
  • Added comprehensive test coverage in anonymous-id.test.ts for URL normalization and cross-platform path handling
  • Extracted unhashedProjectId function for better testability and cleaner code organization

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

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.

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

Copy link
Member
@shilman shilman left a comment

Choose a reason for hiding this comment

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

LGTM

- Paths were not stable between windows + unix
- Remote URLs can be specified without the `.git` extension
@tmeasday tmeasday force-pushed the tmeasday/anonymous-id-tweaks branch from 3a705f3 to 8e0ef7f Compare November 29, 2024 01:09
@tmeasday tmeasday changed the title Fix two issues with anonymous id calculation Telemetry: Fix two issues with anonymous id calculation Nov 29, 2024
Copy link
nx-cloud bot commented Nov 29, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1cc488e. 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.

@shilman shilman added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Nov 29, 2024
@yannbf yannbf changed the title Telemetry: Fix two issues with anonymous id calculation Telemetry: Improve anonymous id calculation Nov 29, 2024
@shilman shilman self-assigned this Dec 2, 2024
@shilman shilman merged commit 8bab9e1 into next Dec 2, 2024
66 checks passed
@shilman shilman deleted the tmeasday/anonymous-id-tweaks branch December 2, 2024 14:08
yannbf pushed a commit that referenced this pull request Dec 5, 2024
Telemetry: Improve anonymous id calculation
(cherry picked from commit 8bab9e1)
@github-actions github-actions bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ci:normal patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch telemetry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0