Skip to content

Commit

Permalink
Add noop mode for unsupported systems
Browse files Browse the repository at this point in the history
Add wildcard triple for unsupported systems

The `any` tag is now installed when downloading the package from an
unsupported system.

Don't start components when on unsupported arch

When trying to run the agent, OpenTelemetry and probes on an unsupported
system (any-any), prevent the three of them from starting.
  • Loading branch information
luismiramirez committed May 30, 2024
1 parent fd8c78c commit 79ee6ac
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 as 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 79ee6ac

Please sign in to comment.