https://github.com/clouddetail/preload
https://github.com/clouddetail/preload
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/clouddetail/preload
- Owner: CloudDetail
- Created: 2024-08-09T08:17:37.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-17T07:34:49.000Z (4 months ago)
- Last Synced: 2025-04-06T05:34:31.738Z (3 months ago)
- Language: Rust
- Size: 42 KB
- Stars: 1
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Preload
A system module that hooks into the operating system's `execve` function to automatically load APM (Application Performance Monitoring) agents.
Key Features:
- Automatically detects the programming language of target applications
- Injects necessary environment variables based on the detected language-specific APM agent
- Auto-generates ServiceName (currently Java only)
- Maintains seamless program execution flow## Installation
- Run `make dist` to create installation files, then execute `bash install.sh` for local installation
- Run `make release` to create `install-apo-instrument.tar.gz` package for deployment on other machines## Uninstallation
Remove the following line from `/etc/ld.so.preload`:
```
/etc/apo/instrument/libapolanucher.so
```
If this is the only line in the file, you can safely remove the entire `/etc/ld.so.preload` file.
Restart your terminal session to complete the uninstallation.**Troubleshooting**
If SSH access becomes unavailable due to preload issues, you can fix it by either:
- Using `scp` to copy an empty file to overwrite `/etc/ld.so.preload` on the target machine
- Completing the uninstallation processTo clean up remaining files afterward:
```
rm -r /etc/apo
```## Usage in Virtual Machines
The preload hook takes effect for all program executions immediately after running `install.sh`.
## Usage in Docker Containers
After installing on the host machine, add these parameters when starting containers:
```
-v /etc/apo:/etc/apo
-e LD_PRELOAD=/etc/apo/instrument/libapolanucher.so
```The `-v` flag mounts the agent files, while `-e` enables the preload library.
Example:
Original docker command:
```
docker run -d exampleApp:tag
```Modified command:
```
docker run -d \
-v /etc/apo:/etc/apo \
-e LD_PRELOAD=/etc/apo/instrument/libapolanucher.so \
exampleApp:tag
```