Guides · 6 min read

Grafana Nanosecond Timestamps and the 1 ms Order-Book Bottleneck

At 14:32:01.412, three events hit the order book inside 411 microseconds:

  • 14:32:01.412000120: A resting 12-lot offer at the best ask cancels.
  • 14:32:01.412038400: An aggressive buyer lifts the new, higher best ask.
  • 14:32:01.412410900: A liquidity provider posts a fresh offer one tick wider.

Plot those three rows on a Grafana time-series panel and all three collapse onto 14:32:01.412. From the chart alone, you cannot tell whether the buyer triggered the cancel or the cancel forced the buyer to pay a worse price.

For trading-infrastructure engineers and quantitative researchers, that is the core failure of Grafana nanosecond timestamp workflows: the database can store nanoseconds, but the visualization layer floors everything to one millisecond.


Why Grafana and Kibana hit a 1 ms floor

Grafana truncates timestamps to milliseconds in its standard time-series panels, and the feature request to support nanosecond precision has remained open since 2016 (grafana/grafana issues #6252 and #69048). Kibana’s date histogram shares the same one-millisecond floor.

The bottleneck sits in three places across the standard observability stack:

  1. Browser Date coordinate truncation: Grafana’s frontend maps panel axes, tooltips, and time-range pickers onto JavaScript Date objects, which represent time in integer milliseconds since the Unix epoch. Sub-millisecond fractions are rounded or dropped before points reach the canvas.
  2. Pull-based metric stores cannot hold book state: Prometheus and Mimir are built for periodic scrapes (typically every 1 s to 15 s) of counters, gauges, and pre-bucketed histograms. Feeding thousands of limit order book deltas per second into a metrics store causes immediate cardinality explosion and loses event-by-event sequence.
  3. Order-book geometry is two-dimensional: A limit order book is not a single scalar line over time. At every nanosecond update, 30 or more price levels on the bid and ask change size simultaneously, which standard line and bar panels are not built to render.

Why ClickHouse and QuestDB SQL workarounds fail for Grafana order book charts

Teams that store raw market data in ClickHouse (DateTime64(9)), QuestDB, or InfluxDB usually try two workarounds to get nanosecond order-book data into Grafana:

-- Common workaround: scale nanoseconds to ms for Grafana's X-axis
SELECT
  CAST(venue_ts_ns / 1000000 AS BIGINT) AS time,
  venue_ts_ns AS raw_nanos,
  best_bid,
  best_ask,
  bid_size_0,
  ask_size_0
FROM l2_book_updates
WHERE symbol = 'BTC-USD'
ORDER BY venue_ts_ns ASC;

That query stops Grafana from throwing epoch errors, but it still breaks microstructure analysis in three ways:

  • X-axis timestamp aliasing: Because time is floored to milliseconds, 50 book updates that arrived inside the same millisecond land on the exact same X-coordinate. Standard panels either overplot them into an unreadable vertical smear or keep only the last point in the bucket.
  • Lost intra-millisecond causality: Hovering over a point may show raw_nanos in a tooltip, yet the visual timeline still hides whether a quote pulled before or after a trade print within that millisecond.
  • No native depth ladder: Even with the Grafana Plotly plugin polling SQL every 250 ms, you are looking at periodic snapshots of aggregated queries rather than continuous, event-by-event book evolution.

How to test if your current dashboard is hiding sub-millisecond events

Before changing any tooling, run a quick check on your own raw DateTime64(9) or nanosecond tick log. Pick a 5-millisecond window around a volatile quote-and-fill event and count how many distinct book updates share the same millisecond:

-- Measure intra-millisecond collision rate in your own L2/L3 capture
SELECT
  toStartOfMillisecond(venue_ts) AS ms_bucket,
  count() AS updates_in_same_ms,
  uniqExact(best_bid, best_ask) AS top_of_book_states_in_ms
FROM l2_book_updates
WHERE venue_ts BETWEEN '2026-11-30 14:32:01.410' AND '2026-11-30 14:32:01.415'
GROUP BY ms_bucket
HAVING updates_in_same_ms > 1
ORDER BY ms_bucket;

Anywhere top_of_book_states_in_ms > 1, your millisecond-floored chart merged multiple top-of-book prices into a single visual state. Every cancel-and-replace burst inside that bucket is invisible on a 1 ms axis.


How VisualHFT Terminal renders nanosecond book updates

VisualHFT Terminal is a native Windows desktop application built on .NET 10 for nanosecond order book visualization and infrastructure observability, rather than a browser-constrained dashboard. It captures with nanosecond-denominated timestamps taken from the venue clock where the venue supplies one, and in non-aggregated mode retains and draws every book update in arrival sequence.

CapabilityStandard Grafana / KibanaClickHouse / QuestDB + Grafana PlotlyVisualHFT Terminal (Non-Aggregated)
Timestamp floor1 ms (JS Date truncation)1 ms X-axis (requires SQL scaling)Nanosecond venue timestamps preserved
Sub-ms update retentionCollapsed into 1 ms bucketsAliased on shared ms coordinatesEvery book update retained in sequence
Order-book depth viewNot nativeCustom SQL + Plotly depth pollingNative LOB TimeSeries + Depth Chart
Resting-size visibilityRequires custom aggregationHeavy per-level array queriesUp to 30 levels/side within 0.3% of mid
Setup to first book viewSchema + exporter + panel JSONDB ingestion + custom SQL + pluginsNative desktop install + live connectors

Reading the LOB TimeSeries and Depth Chart together

The LOB TimeSeries chart plots best ask, best bid, mid-price, and spread over a rolling 5,000-point window alongside resting-size scatter dots across up to 30 price levels per side within 0.3% of mid:

  • Persistent vs. fleeting liquidity: Dot area scales relative to the resting size range observed in the session. A horizontal band of large dots at one price level marks resting liquidity that holds across updates; dots that appear and vanish between trades expose fleeting size that pulled before fills arrived.
  • Exact sequence without time-bucketing: In non-aggregated mode, zero-millisecond bucketing preserves every quote step and spread widening event in the order the venue published it.

NASDAQ TotalView-ITCH 5.0 nanosecond auction replay (AAPL, 22 Aug 2023): DOM ladder, Depth Chart, LOB TimeSeries, Time and Sales, and study tiles reacting together to raw exchange messages.

Separating venue bursts from infrastructure lag

When a book update arrives late, a price-only chart cannot tell you whether the exchange stalled or your own feed handler fell behind. Alongside the order-book views, VisualHFT Terminal’s Infrastructure Monitoring workspace tracks live per-venue message rates, sequence-gap indicators, network path latency percentiles, and venue-clock deltas on the same desktop platform.

Live feed message rates, latency percentiles, and host resource telemetry running alongside order-book analytics.


Next step on your own feed

Run the intra-millisecond collision query above on five minutes of your busiest symbol. If you see multiple top-of-book states packed into single millisecond buckets, connect that live or custom feed to VisualHFT Terminal in non-aggregated mode to inspect the exact quote-to-fill sequence without a 1 ms ceiling.

VisualHFT Terminal live Kraken BTC/USD showcase: synchronous LOB Imbalance and Mid Price ChartStudy tracking a -0.90 drop, 0.8-second lead gap, bid depth depletion, and DOM ladder breakdown.
Static reference capture from Grafana Nanosecond Timestamps and the 1 ms Order-Book Bottleneck
#Grafana #Nanosecond Timestamps #Infrastructure Monitoring #Feed Latency #Observability #Order Book #ClickHouse #QuestDB