Rust Analytics Sentry
The GN-Apex telemetry engine is a standalone daemon written in Rust (Actix-web). It ingests high-volume event streams, enriches metadata in memory, executes statistical bot detection, and broadcasts live dashboard telemetry.
“High-throughput stream processing with zero garbage collection pauses. Built to withstand massive traffic spikes.”
The Sentry Architecture
The engine operates on four decoupled layers designed to isolate ingress latency from heavy analytical computing:
Stream FIFO Buffer
Appends events to Redis Streams with a 1,000,000 max length cap. Returns HTTP 202 in single-digit ms.
Anomaly Engine
Statistical Z-Score outlier detection, Haversine impossible-travel velocity, and Tor exit-node blocking.
N → 1 Deduplication
Aggregates 500 events across 50 sessions into single bulk MongoDB upserts, eliminating database pressure.
Live Fan-Out
Subscribes to Redis Pub/Sub channels ('live_events:*') and multicasts telemetry to dashboard lobbies.
The High-Speed Write Path
When an event arrives at POST /api/collect, the daemon executes a non-blocking sequence:
- API Key Authentication: Validates public/secret tokens in memory using an LRU cache.
- Rate Limit Check: Evaluates client IP quotas against governor token buckets (L1) and Redis sliding windows (L2).
- Redis Stream Ingestion: Appends the packet to
events_streamand immediately responds withHTTP 202 Accepted.
Asynchronous Enrichment
Background worker threads drain the stream and apply real-time enrichment:
| Parameter | Type | Requirement | Description |
|---|---|---|---|
| GeoIP2 & ASN | MaxMind DB | Optional | Resolves Country, City, Coordinates, and Autonomous System Numbers (ISP/Hosting detection). |
| User-Agent Parser | DashMap Cache | Optional | Extracts OS, Browser, and Device category with in-memory lock-free caching for high concurrency. |
| B2B Lead Scoring | Firmographics | Optional | Calculates commercial value (0-100 pts) based on corporate domain signals and sends Slack alerts for hot leads (≥70). |
| Behavioral Analytics | Heuristics | Optional | Identifies rage clicks (3+ clicks in 400px zone within 1000ms), dead clicks, and scroll depth milestones. |
Dual Query Modes (Fast vs. Deep)
project_summaries documents for instantaneous overview charts.Deep Mode (O(events)): Executes full MongoDB aggregation pipelines across raw event collections for forensic breakdowns.