Skip to content

Add analytics reporting for the x86 version - #24054

Open
SMillerDev wants to merge 1 commit into
mainfrom
feat/analytics/report_x86_version
Open

SMillerDev wants to merge 1 commit into
mainfrom
feat/analytics/report_x86_version

Conversation

@SMillerDev

@SMillerDev SMillerDev commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Inspired by https://github.com/orgs/Homebrew/discussions/7092#discussioncomment-18528421, this now reports if the x86 processor has v1-4 support. That would be good to know to potentially make bottles on newer x86 versions saving developers time and the world energy by using more optimized instructions.

Summary by CodeRabbit

  • New Features
    • Linux package analytics now include CPU family information. Supported ARM processors are identified by model, while Intel and AMD detection remains available.
  • Bug Fixes
    • Unmapped ARM processors receive a hexadecimal unknown-family label. Other unrecognised processor types may be reported as unknown or undetermined; PowerPC processors are now reported as undetermined.

@MikeMcQuaid

Copy link
Copy Markdown
Member

Passing on this given conversation in the discussion.

@SMillerDev

Copy link
Copy Markdown
Member Author

I've read it again, but I only see argument there in favour of tracking this information.

@MikeMcQuaid

Copy link
Copy Markdown
Member

@SMillerDev TL;DR: I don't see a world in which we change this and do a mass rebottling for something without significant performance benchmarks, unless we're getting a hard 0️⃣ here. As-is this will mess with our existing analytics here too. I just don't think it's worth the large amount of effort here and breakage.

@MikeMcQuaid
MikeMcQuaid deleted the feat/analytics/report_x86_version branch September 21, 2026 20:44
@cho-m

cho-m commented Sep 22, 2026

Copy link
Copy Markdown
Member

I do see a possible future where we add a separate bottle for x86_64_v3_linux, maybe selectively for formulae that actually benefit.

This is the direction that major Linux distros have been preparing recently so users may start seeing a performance loss if switching from system to Homebrew binaries:

@MikeMcQuaid
MikeMcQuaid restored the feat/analytics/report_x86_version branch September 22, 2026 13:49
@MikeMcQuaid

Copy link
Copy Markdown
Member

@cho-m Thanks for context. I think logical time for this sort of change for us might be when we're doing Ubuntu/GCC/glibc version migrations. We could start using different bottle tags for each of those and consider adjusting what we support for Intel/ARM at those points.

@MikeMcQuaid MikeMcQuaid reopened this Sep 22, 2026
Comment thread Library/Homebrew/utils/os.sh Outdated
Comment thread Library/Homebrew/utils/analytics.rb Outdated
@SMillerDev
SMillerDev force-pushed the feat/analytics/report_x86_version branch from 3887d4a to 690f08d Compare September 28, 2026 10:36
Comment thread Library/Homebrew/extend/os/linux/hardware/cpu.rb Outdated
Comment thread Library/Homebrew/extend/os/linux/hardware/cpu.rb Outdated
Comment thread Library/Homebrew/brew.sh Outdated
@SMillerDev
SMillerDev force-pushed the feat/analytics/report_x86_version branch from 690f08d to 90bc603 Compare October 8, 2026 12:34
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4ec98989-db83-4558-903b-8de5d5ed4754
📥 Commits

Reviewing files that changed from the base of the PR and between ca12a5d and 8266383.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Linux CPU family detection maps supported ARM models to architecture symbols and retains Intel and AMD detection. Package analytics adds the detected CPU family as a tag.

Changes: CPU family analytics

Layer / File(s) Summary
Linux CPU family detection
Library/Homebrew/extend/os/linux/hardware/cpu.rb
ARM detection maps implementer and CPU-part values to architecture symbols. Intel and AMD detection remains. Unmatched ARM combinations return hexadecimal unknown symbols, while other unmatched processors return :dunno.
CPU family analytics tag
Library/Homebrew/utils/analytics.rb, Library/Homebrew/test/utils/analytics_spec.rb
default_package_tags adds the CPU family as a string-valued tag. The ARM custom-prefix test checks for the :cpu_family tag. A Linux-only test checks that an ARM CPU produces the "armv8_0_a" tag.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to ca12a

Supported Linux PowerPC hosts will lose the ppc label in analytics and 32-bit installation metadata. Restore the PowerPC family branch before relying on these reports.

### Architecture Summary

Architecture risk: 🔵 Low · up to ca12a

The change affects 1 system.

Changed systems: Library

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — Library (service) was modified; 3 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in Library/Homebrew/utils/analytics.rb: default_package_tags now includes the CPU family as a string-valued analytics tag.
  • observed — Modified behavior in Library/Homebrew/extend/os/linux/hardware/cpu.rb: Adds HEX_BASE with value 16 for hexadecimal formatting used by CPU family detection.
  • observed — Modified behavior in Library/Homebrew/extend/os/linux/hardware/cpu.rb: family replaces the unconditional :arm result and explicit :ppc result with ARM implementer/model detection and dispatch to arm_family. Intel and AMD detection remains, while non-ARM, non-Intel CPUs—including PowerPC—now return :dunno.
  • observed — Modified behavior in Library/Homebrew/extend/os/linux/hardware/cpu.rb: Adds arm_family, which returns a hexadecimal unknown_… symbol for implementers other than 0x41 or unmapped models, and maps listed Arm CPU models to ARMv7-A, ARMv8 and ARMv9 family symbols.
Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title correctly identifies the addition of analytics reporting, which is part of the change. However, the implementation reports ARM CPU family data rather than an x86 version, so the architecture…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title correctly identifies the addition of analytics reporting, which is part of the change. However, the implementation reports ARM CPU family data rather than an x86 version, so the architecture description is inaccurate.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@SMillerDev
SMillerDev force-pushed the feat/analytics/report_x86_version branch from 90bc603 to ccb4ca6 Compare October 8, 2026 12:35
Comment thread Library/Homebrew/extend/os/linux/hardware/cpu.rb Outdated
Comment thread Library/Homebrew/extend/os/linux/hardware/cpu.rb Outdated
Comment thread Library/Homebrew/extend/os/linux/hardware/cpu.rb
Comment thread Library/Homebrew/extend/os/linux/hardware/cpu.rb
@SMillerDev
SMillerDev force-pushed the feat/analytics/report_x86_version branch 3 times, most recently from 9e15d70 to 279c283 Compare October 19, 2026 07:43
@SMillerDev
SMillerDev marked this pull request as ready for review October 19, 2026 07:45

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 607f29f1-f270-4204-8f8d-c298f80d1268
📥 Commits

Reviewing files that changed from the base of the PR and between 8f10429 and 279c283.

📒 Files selected for processing: 3
  • Library/Homebrew/extend/os/linux/hardware/cpu.rb
  • Library/Homebrew/test/utils/analytics_spec.rb
  • Library/Homebrew/utils/analytics.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Comment thread Library/Homebrew/extend/os/linux/hardware/cpu.rb Outdated
Comment thread Library/Homebrew/extend/os/linux/hardware/cpu.rb
@SMillerDev

Copy link
Copy Markdown
Member Author

Output from my RPI now:

HOMEBREW_VERSION: 7.0.9-161-g5ab0620
ORIGIN: https://github.com/Homebrew/brew
HEAD: 5ab06207b34e09426ad0ca94de7110c577b915fb
Last commit: 3 minutes ago
Branch: feat/analytics/report_x86_version
Core tap: N/A
Core cask tap: N/A
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
Homebrew Ruby: 4.0.7 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/4.0.7_1/bin/ruby
CPU: quad-core 64-bit armv8_0_a

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments: 1
Library/Homebrew/test/utils/analytics_spec.rb: 1

38-43: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Keep the existing custom-prefix example cross-platform and add a Linux consumer example.

:needs_linux would skip the existing example on macOS. Keep that example unchanged. Add a separate Linux-only example that supplies ARM cpuinfo data and asserts the serialised analytics value. A fixture used only by arm_family tests would not test default_package_tags.

Suggested fix
     it "returns OS_VERSION, ARM and prefix when HOMEBREW_PREFIX is a custom prefix on arm" do
       expect(Homebrew).to receive(:default_prefix?).and_return(false).at_least(:once)
       expect(described_class.default_package_tags).to have_key(:cpu_family)
       expect(described_class.default_package_tags).to have_key(:arch)
       expect(described_class.default_package_tags[:arch]).to eq HOMEBREW_PHYSICAL_PROCESSOR
       expect(described_class.default_package_tags).to have_key(:prefix)
       expect(described_class.default_package_tags[:prefix]).to eq "custom-prefix"
     end
 
+    it "serialises the Linux ARM CPU family in the package tags", :needs_linux do
+      allow(Hardware::CPU).to receive_messages(arm?: true, intel?: false)
+      allow(Hardware::CPU).to receive(:cpuinfo).and_return(
+        "CPU implementer : 0x41\nCPU part : 0xd08\n",
+      )
+      described_class.clear_cache
+
+      expect(described_class.default_package_tags[:cpu_family]).to eq "armv8_0_a"
+    end
+

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84644939-885c-4d00-aaac-221244b44c38
📥 Commits

Reviewing files that changed from the base of the PR and between 279c283 and 5ab0620.

📒 Files selected for processing: 1
  • Library/Homebrew/extend/os/linux/hardware/cpu.rb
🚧 Files skipped from review as they are similar to previous changes: 1
  • Library/Homebrew/extend/os/linux/hardware/cpu.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@SMillerDev
SMillerDev force-pushed the feat/analytics/report_x86_version branch from 5ab0620 to ca12a5d Compare October 19, 2026 08:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Preserve the PowerPC family value before the unknown fallback. · cpu.rb:43-47

Library/Homebrew/extend/os/linux/hardware/cpu.rb:43-47
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Preserve the PowerPC family value before the unknown fallback.

A supported Linux PowerPC host reaches this branch and now reports :dunno. This changes the cpu_family package analytics value and the 32-bit PowerPC installation metadata from ppc to dunno. Add a PowerPC branch so the new ARM unknown-family behaviour remains unchanged.

Suggested fix
-            else
+            elsif ppc?
+              :ppc
+            else
               :dunno

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 39f16fb7-444f-4e51-a195-289dba48f543
📥 Commits

Reviewing files that changed from the base of the PR and between 5ab0620 and ca12a5d.

📒 Files selected for processing: 1
  • Library/Homebrew/test/utils/analytics_spec.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@SMillerDev
SMillerDev force-pushed the feat/analytics/report_x86_version branch from ca12a5d to 8266383 Compare October 19, 2026 08:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants