← Back to blog
Solution 4 min read 炬鲸团队

Observability for Securities Trading Systems: From Latency to Root Cause

A complete observability approach for latency-sensitive securities trading systems: tracing, metric monitoring, alert noise reduction, and postmortem-driven improvement, with key thresholds and severity guidance.

Observability for Securities Trading Systems: From Latency to Root Cause

Trading systems are extremely latency-sensitive, and a single incident can cost real money. Rather than "check the logs after something breaks," the more effective move is to build observability properly up front. This article lays out a framework you can put into practice directly.

A Monitoring Baseline Built Around Latency

On a trading path, latency is the top-priority metric. Instrument each hop separately, such as gateway intake, risk checks, matching, and order acknowledgment, record latency for every one of them, and aggregate P50/P99/P999 on the metric side:

| stats p50(latency), p99(latency), p999(latency) by step

Use two alert tiers: notify when P99 exceeds 50ms, and page when it exceeds 100ms. Jitter in latency deserves more attention than a sudden change in absolute value, so add a period-over-period check on P99 to catch slow degradation that creeps up without ever crossing a fixed line. Alongside latency, track error rate and throughput for every hop — looking at the three together tells you whether the system is getting slower or actually misbehaving.

How you record that latency matters as much as the numbers themselves. The cleanest approach is to open a span at the entry of each hop and close it at the exit, let the tracing library produce the duration, and then emit that same duration as a metric with the hop name as a label. That way the trace and the metric always agree, and you never end up maintaining two separate timing implementations that drift apart.

Trace One Order's Whole Life with trace_id

From client order placement to acknowledgment, tie every order together with an order_id / trace_id. During an incident, that id is all you need to reconstruct every node and every hop's cost on the tracing page, and to judge whether the problem is network jitter, a blocked downstream, or your own slow processing. This is especially valuable for "intermittent latency that's hard to reproduce" — keep the traces of sporadic orders and replay them afterward; they often surface intermittent issues that ordinary monitoring never catches.

A Dashboard That Actually Matters

Wall displays only help if they answer the question on everyone's mind. Keep one screen to four numbers: current P99 latency per hop, error rate per hop, matching throughput, and the count of open P0/P1 alerts. Below them, a per-hop latency heatmap over the last hour makes slow degradation visually obvious long before it trips a threshold. Resist the urge to cram every metric onto the board; a dashboard with forty panels is a dashboard nobody reads.

Alert Tiers and Noise Reduction

Financial systems generate a lot of alerts and a lot of noise, which leads to alert fatigue. Use three tiers:

  • P0: matching unavailable, or P99 latency above threshold for 5 minutes straight -> phone + SMS
  • P1: single-node anomaly, sudden error-rate spike -> WeCom/DingTalk
  • P2: elevated resource usage, growing slow queries -> log a to-do, don't wake anyone

Combine alert aggregation and silence rules to collapse alerts with the same root cause into a single notification and avoid alert storms. Crucially, bind tiers to your on-call schedule and escalation path, so every alert has a clear owner and a defined "who to page if the first person can't handle it." Run a regular fire drill: kill a non-critical dependency and check that the alert fires, routes to the right person, and is acknowledged within the target time.

Postmortems and Capacity Planning

Observability data is not just for firefighting. Pull peak-hour data on a schedule for capacity analysis and catch bottlenecks early. After every incident, export the full traces and metrics, produce a postmortem, and turn the lessons into new alert rules. That way the system gets steadier over time instead of starting from scratch on every outage. The point of a postmortem is not assigning blame; it's asking why monitoring didn't catch the problem earlier and closing that blind spot, so the next incident of the same kind is caught before customers notice. Finally, remember that trading systems carry audit-trail obligations — logs must be retained for the required period and be exportable on demand, so long-term retention belongs in the plan from day one.