Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

[platform] Detect if running under Rosetta translator #77

Merged
merged 3 commits into from
Mar 3, 2021

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Mar 2, 2021

What does this PR do?

  • Bump golang.org/x/sys package version
  • Detect whether running under Rosetta on a macOS M1 chip.

Additional notes

To detect whether we are running under Rosetta we follow the official Apple docs recommendation

Bump `golang.org/x/sys` package to latest version
@mx-psi mx-psi marked this pull request as ready for review March 2, 2021 13:32
@mx-psi mx-psi requested a review from a team March 2, 2021 13:32
Copy link
Contributor

@albertvaka albertvaka left a comment

Choose a reason for hiding this comment

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

LGTM

@mx-psi mx-psi merged commit 6b668ac into master Mar 3, 2021
@mx-psi mx-psi deleted the mx-psi/macos-m1-support branch March 3, 2021 10:26
hush-hush pushed a commit that referenced this pull request Apr 13, 2023
* Detect whether running under Rosetta translator
Bump `golang.org/x/sys` package to latest version

* Fix merge
Bump sys package
mx-psi added a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Jul 18, 2023
)

**Description:** 

Add `host.arch` to system detector. It is detected via `runtime.GOARCH`.

This way of detecting may be wrong if running under an emulator or
binary translator; the only common case I know of this happening in
practice is on ARM64 macOS when using Rosetta. There is a way to detect
this (see DataDog/gohai/pull/77) but since we provide arm64 builds for
macOS, I think this is a non-issue

**Link to tracking Issue:** Fixes #22939

**Testing:** Added unit tests. Tested on my Linux AMD64 laptop

**Documentation:** Documented new attribute on README
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants