Skip to content

fix: host.arch reports real CPU arch, not the hostname (#90)#91

Merged
michaelbushe merged 1 commit into
mainfrom
fix/host-arch-detector
Jul 20, 2026
Merged

fix: host.arch reports real CPU arch, not the hostname (#90)#91
michaelbushe merged 1 commit into
mainfrom
fix/host-arch-detector

Conversation

@michaelbushe

Copy link
Copy Markdown
Member

Fixes #90.

The bug

The IO resource detector copy-pasted Platform.localHostname into host.arch, so every VM-platform resource carried e.g. host.arch: "my-macbook" instead of the CPU architecture. Backends selecting per-architecture artifacts off the resource (debug symbols for native crash symbolication) got junk to key on.

Fix

  • Real arch: resolve host.arch from Platform.version's on "<os>_<arch>" tail, mapped to registry values (amd64/arm64/arm32/x86/riscv*); omit the attribute when unparseable. Pure Dart, no dart:ffi.
  • Typo-proof keys: every attribute is now keyed from the generated registry enums (Host.*, Os.*, ProcessAttributes.*) rather than string literals — a mistyped key is now a compile error, which is exactly the bug class that produced IO resource detector sets host.arch to the hostname #90. This also caught a second literal bug: the malformed host.os.name is corrected to the registry os.name.
  • Registry-pure: dropped host.processors, host.locale, and process.num_threads — none are OTel registry attributes (verified against the v1.43.0+21 model). Their tests are removed with them.

Verification

resource_detector_test.dart: 32 pass (host.arch now asserted to be a registry arch value and not the hostname). Analyze clean. The 2 failures in context_propagation_test on the full suite are pre-existing flaky collector-integration tests (timeouts / double-init), unrelated to this change.

🤖 Generated with Claude Code

The IO resource detector copy-pasted Platform.localHostname into
host.arch. Resolve the real architecture (amd64/arm64/arm32/x86/riscv*)
from Platform.version's 'on "<os>_<arch>"' tail, mapped to registry
values; omit when unparseable.

Also key every attribute from the generated registry enums (Host.*,
Os.*, ProcessAttributes.*) instead of string literals so a mistyped key
is a compile error — the exact bug class behind #90 — and correct the
malformed host.os.name to os.name.

Drop host.processors, host.locale, and process.num_threads: none are
OTel registry attributes.

Fixes #90.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@michaelbushe
michaelbushe merged commit d40d850 into main Jul 20, 2026
6 checks passed
@michaelbushe
michaelbushe deleted the fix/host-arch-detector branch July 20, 2026 21:15
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.

IO resource detector sets host.arch to the hostname

1 participant