Trading systems are extremely sensitive to latency and availability. This post shows how to use tracing to locate millisecond-level jitter, guard the open and close windows with logs and alerts, and satisfy audit requirements.
A trading chain runs from market-data ingestion and risk checking through order routing to order acknowledgement, with many hops and a latency budget measured in milliseconds. A sporadic 200ms jitter is usually gone hours before a user complains, and the scene has long since vanished. Observability's value here is turning "after-the-fact review" into "visible in real time and traceable afterwards."
Instrument the full trading chain — market-data gateway → risk → matching/routing → order submission → acknowledgement — with a span on every hop and its duration recorded. When a request shows abnormal latency, expand it by trace id and see exactly which hop is slow:
order-place (12ms)
├─ risk-check (3ms)
├─ route-order (2ms)
├─ order-ack (180ms) ← the jitter
└─ notify (1ms)
Here order-ack is the problem, so drill into that service's logs to tell whether it was network retransmission, queueing at the upstream gateway, or a GC pause. The span tells you where; the log tells you why.
One caveat: at trading volumes, tracing every request can be expensive. Use head-based sampling — always sample requests that are slow, failed, or touch certain critical paths, and drop the rest. A fixed 100% sampling rate will drown the backend without improving resolution on the rare requests you actually care about.
Beyond tracing, set SLOs on the percentiles that matter, not just the average. Average latency hides tail behavior, and in trading the tail is where the money and the complaints are. Track p99 and p99.9 per critical endpoint, and alert on a rising percentile over a rolling window rather than on instantaneous spikes. A single slow request is interesting; a rising p99.9 is actionable.
Also capture the order lifecycle end to end, from client order entry to exchange acknowledgement and back. A gap at any hop — an order that entered but never returned an acknowledgement — is the single most important anomaly to detect, because it is the one users notice first.
Market open and close are when incidents cluster and where monitoring should concentrate:
Alert thresholds should vary by period: the same error rate that is normal during the opening auction can be a failure during quiet hours. Observe supports per-period thresholds, so set three profiles — open, close and quiet — instead of one fixed value that either cries wolf at the open or misses failures in the afternoon.
Trading logs are not just a debugging tool; they are a compliance record. Audit requires logs to be tamper-proof, traceable and retained for a defined period. Three points when implementing:
Do not try to "collect everything" in a trading system. Start with latency and error rate — the two metrics that best reflect business health — get the tracing complete and the alerting tuned, then expand to other dimensions gradually. Your observability investment must answer one question directly: where and why did this order go slow or wrong? If it cannot answer that, more collection is just noise. Every dashboard, alert and trace you add should map back to that single question, or it does not earn its place.
Finally, rehearse the failure. Run a game day where you inject 300ms of latency into the acknowledgement hop and confirm the team can locate it from alert to span in under ten minutes. If they cannot, fix the instrumentation or the alerting before the market does it for you. Make the drill a quarterly habit, and refresh the runbook each time — the tools change, the failure modes do not.