RemcoSmitsDev/php-tracking-daemon

The daemon that receives all the information from the PHP processes and send it to the backend.

★ 0Forks 0RustGitHub ↗Compare

README

PHP Tracking Daemon

A high-performance daemon that accepts profiling data from the PHP tracking extension over a Unix socket and forwards it to the backend via a WebSocket connection.

Prerequisites

Important: The backend must be running and accepting WebSocket connections before starting the daemon. The daemon establishes a WebSocket connection to the backend on startup and will exit immediately if it cannot connect.

Building

cargo build --release

The compiled binary will be at target/release/php-tracking-daemon.

Usage

php-tracking-daemon --ws-host <hostname:port>

The --ws-host (or -H) argument is required and should be the hostname and port of the backend. Do not include the protocol or path — the daemon automatically constructs the full WebSocket URL (ws://<host>/ws).

Examples

# Connect to a backend running on localhost
php-tracking-daemon --ws-host localhost:3000

# Using the short flag
php-tracking-daemon -H localhost:3000

Help

php-tracking-daemon --help

How It Works

  1. The daemon listens for incoming connections on a Unix socket at /tmp/php-tracking-daemon.sock.
  2. The PHP tracking extension sends profiling data to this socket.
  3. The daemon compresses the data with gzip and forwards it to the backend over WebSocket.
  4. Multiple worker threads process messages concurrently for high throughput.
  5. If the WebSocket connection drops, the daemon automatically attempts to reconnect with exponential backoff.

Contributors

RemcoSmitsDev

Issues