Skip to content

Commit

Permalink
Merge pull request #212 from appsignal/add-none-any-triple-release
Browse files Browse the repository at this point in the history
[WIP] Add noop mode for unsupported systems
  • Loading branch information
luismiramirez authored Jun 4, 2024
2 parents 5c7591d + 5ed6e44 commit c8e5c4e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changesets/add-noop-mode-for-unsupported-systems.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "add"
---

Unsupported systems, like Microsoft Windows, won't start the agent and other integration components to prevent them from failing and allowing apps to be run normally.
9 changes: 9 additions & 0 deletions src/appsignal/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ class Agent:

def start(self, config: Config) -> None:
config.set_private_environ()

if self.architecture_and_platform() == ["any"]:
print(
"AppSignal agent is not available for this platform. "
"The integration is now running in no-op mode therefore "
"no data will be sent to AppSignal."
)
return

p = subprocess.Popen(
[self.agent_path, "start", "--private"],
stdout=subprocess.PIPE,
Expand Down
2 changes: 2 additions & 0 deletions src/appsignal/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def start(self) -> None:
if self._config.is_active():
logger.info("Starting AppSignal")
agent.start(self._config)
if not agent.active:
return
start_opentelemetry(self._config)
self._start_probes()
else:
Expand Down
6 changes: 6 additions & 0 deletions src/scripts/build_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ def initialize(self, _version: str, build_data: dict[str, Any]) -> None:

rm(agent_path)

if triple == "any":
print("Skipping agent download for `any` triple")
with open(platform_path, "w") as platform:
platform.write(triple)
return

tempdir_path = os.path.join(self.root, "tmp", triple)
os.makedirs(tempdir_path, exist_ok=True)

Expand Down
1 change: 1 addition & 0 deletions src/scripts/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
# https://peps.python.org/pep-0656/
"aarch64-linux-musl": "musllinux_1_1_aarch64",
"x86_64-linux-musl": "musllinux_1_1_x86_64",
"any": "any",
}

0 comments on commit c8e5c4e

Please sign in to comment.