30% offEnding soon
FSD-025Frontend system design Premium

Design a Metrics Explorer Like Grafana

Design a metrics explorer with query drafts, time ranges, adaptive resolution, live tail, accessible charts, cost limits, and shareable state.

Advanced 60 min read

A metrics explorer is a versioned query workbench, not a chart with a text box. It separates draft edits from committed executions, derives a bounded resolution from time range and viewport, normalizes provider results into typed frames, guards each response by query revision, and stores only safe, reproducible state in the URL.

An explorer is used when the user does not yet know the answer. They may start with a metric name, add label filters, compare two environments, zoom into a spike, switch from graph to table, inspect the request cost, and send the exact investigation to a teammate. Each step changes a contract that the frontend must own deliberately.

The browser should coordinate query drafts, committed revisions, time range, resolution, request cancellation, result normalization, rendering, inspection, and shareable state. The service should authorize data sources, parse provider-specific queries, enforce budgets, execute work, normalize errors, and protect credentials.

Clarify the investigation workflow

Ask which metric languages and data sources are supported, whether users can run multiple queries, how absolute and relative ranges behave, whether live mode is required, how many series and points are safe, which chart and table views exist, what query statistics are exposed, how links are shared, and what permissions constrain metric names and labels.

For this design, assume an authenticated operations tool with a Prometheus-like first provider. A user can build several query rows, run them together, compare graph and table results, inspect execution statistics, zoom and brush a time range, enter live mode, and copy a reproducible link. Desktop is the authoring surface. Mobile supports reading, range changes, and basic query execution.

Alert-rule editing, dashboard layout, long-term metric storage, and implementation of the query language are separate systems.

The public interview prompt

Design a production metrics explorer. Explain:

  • draft, committed, URL, cached, and rendered query state;
  • metric discovery, label filters, variables, query validation, and multiple rows;
  • absolute and relative time ranges, step calculation, downsampling, point and series limits;
  • request generations, cancellation, partial results, warnings, statistics, and stale responses;
  • provider adapters, canonical data frames, chart, table, exemplars, and query inspection;
  • historical snapshots, live tail, cursors, overlap, deduplication, gaps, pause, and resume;
  • shareable links, browser history, saved investigations, permissions, and redaction;
  • accessible charts, keyboard inspection, internationalized time, performance, testing, and rollout.

What the premium solution covers

The complete solution builds a four-layer state model, a canonical query plan, an adaptive step budget, a provider-neutral frame contract, a revision-safe execution lifecycle, a historical-to-live seam, URL history policy, cost controls, accessibility alternatives, observability, testing, and an interview rubric.

Original media shows resolution increasing as the visible range expands, maps ownership across draft and committed state, normalizes provider results for graph and table views, and explains the snapshot-to-live handoff. Two deterministic labs let the reader tune point budgets and exercise URL history policy.

Premium solution

Continue with the complete system design

Unlock the architecture, state machine, API contracts, original diagrams, positioning model, accessibility decisions, performance budgets, testing plan, rollout strategy, scoring rubric, and interview walkthrough.

  • Detailed, beginner-friendly explanation
  • Production failure modes and trade-offs
  • Mobile-friendly architecture diagrams
  • Senior and staff-level interview signals
Unlock Premium

Frequently asked questions

What is the difference between a dashboard and a metrics explorer?
A dashboard presents saved views for repeated monitoring. An explorer supports uncertain, iterative investigation: edit queries, compare results, inspect raw responses, change resolution, and share exact analysis state.
How should a metrics explorer choose the query step?
Use the largest of the source minimum interval, the user's explicit minimum, and the range divided by a bounded point budget derived from chart width. The backend must still enforce its own cost limits.
Should every query-editor keystroke update the URL and run a request?
No. Keep editor text as draft state. Commit on an explicit run or deliberate navigation, then serialize the committed canonical state. Replace transient URL edits and push meaningful navigation points.
How does live mode connect to historical data?
Start with a bounded historical snapshot, then resume from an opaque cursor. Dedupe the overlap, require ordered patches, detect gaps, and resnapshot when replay cannot restore continuity.
How do you make a metrics chart accessible?
Give the chart a concise text summary and offer the same bounded data in a semantic table. Keyboard inspection, visible focus, non-color encodings, and announced range changes should not depend on canvas pixels.
What belongs in a shareable metrics-explorer URL?
Serialize the committed data source, normalized queries, variables, absolute or relative time contract, display mode, and schema version. Exclude credentials, hover state, transient drafts, raw results, and private identifiers.