Introducing a new way to review your PRs.

Read the announcement

hyperdxio / hyperdx

Resolve production issues, fast. An open source observability platform unifying session replays, logs, metrics, traces and errors powered by ClickHouse and OpenTelemetry.

View on GitHub

19 documents · Updated Oct 30, 2026

docs / explorer-and-query-experience

Explorer and query experience

The explorer is the main product flow for turning telemetry questions into useful results. An engineer selects a log, trace, or metric source, sets a time window, writes a search or metric expression, and adds field filters; the system combines these choices into a shared query model, renders the needed request, and returns rows and charts for further investigation.

Exploration workspace

The search page keeps the active source and query in the URL so a search can be refreshed, shared, saved, or opened again without losing its meaning. Its result area connects event rows with charts, row detail panels, trace links, and session links.

Search input and query state

The search input offers two ways to express a condition: Lucene for event-oriented search and SQL for direct ClickHouse predicates. The source, language, selected columns, sort order, and structured filters form one search configuration; saved searches reuse the same shape. The input also gives field suggestions, query history, syntax help, and a plain-language explanation for Lucene expressions.

The page writes meaningful query state to URL parameters. Encoded string and JSON values protect spaces, line breaks, quotes, and filter structure when links pass through systems that change URL encoding. Older links remain readable. A saved-search route fills the form only when the URL has no explicit search configuration, so a shared link can override the stored search. A source name can resolve to its source ID without rewriting the other URL values.

The page keeps the form and URL in step as sources and saved searches load. When a user changes the source, it resets source-specific columns and ordering, then removes filters and histogram groups that the new schema cannot support after its columns arrive. This prevents a visible control from describing a different query than the one sent to ClickHouse.

References: packages/…/DBSearchPage.tsx• L1062-1127 packages/…/DBSearchPage.tsx• L1189-1321 packages/…/DBSearchPage.tsx• L1475-1581 packages/…/SearchWhereInput.tsx• L129-183 packages/…/SearchInputV2.tsx• L44-126 packages/…/queryParsers.ts• L8-108

Facet filters and metadata

The filter panel turns source metadata into field groups and value lists. It lets a user include values, exclude values, choose a numeric range, add a field to the result columns, and focus on a single value. Facets are loaded for the active time window and can load more values when needed, so the panel helps users discover the shape of unfamiliar telemetry without requiring them to know every field name.

The metadata service keeps schema and facet lookups tied to the selected source and time window. It can use available indexes or rollups for fast key discovery, then use a bounded source query when those paths are unavailable or return no values. When a source does not provide the table needed for discovery, the facet flow can use an explicit table connection; the source remains authoritative whenever it can answer. This keeps the filter experience useful across different ClickHouse versions and table shapes without changing the filter model.

Nested paths keep their source type: JSON fields use quoted accessors, Map fields use string-key subscripts, and array positions use ClickHouse indexing. User-provided keys are escaped before they enter an expression. The panel keeps a clean field name for the UI and a quoted SQL expression for value and distribution queries. Pinned values can stay visible even when they are not in the current facet sample, while extra values load only for the current source, time range, and filter scope. When the source changes, filters that do not match the new source schema are removed rather than sent to the new query.

References: packages/…/hooks.ts• L39-64 packages/…/hooks.ts• L98-212 packages/…/hooks.ts• L215-302 packages/…/hooks.ts• L305-437 packages/…/DBSearchPageFilters.tsx• L1198-1450 packages/…/DBSearchPageFilters.tsx• L1495-1649 packages/…/searchFilters.tsx• L19-42 packages/…/searchFilters.tsx• L106-137 packages/…/searchFilters.tsx• L278-303 packages/…/utils.ts• L1149-1205

Time range and live tail

The time control defines the rows that the explorer may return. It supports an explicit range and relative ranges, while Live Tail continuously advances a recent window. A query runs when the user submits a search or changes a filter; in Live Tail, background refreshes pause when the tab is hidden or another query is still running.

Changing the time mode also changes how the page behaves. Scrolling, opening row details, selecting a fixed range, or using analysis modes leaves Live Tail so the displayed data stays stable while the user investigates it. When a chart source exposes more than one timestamp expression, the chart uses the most precise usable date-time column for its buckets; this prevents a date-only column from collapsing a whole day into one point.

References: packages/…/timeQuery.ts• L75-145 packages/…/timeQuery.ts• L205-326 packages/…/DBSearchPage.tsx• L1583-1595 packages/…/DBSearchPage.tsx• L1619-1625 packages/…/utils.ts• L159-279

Results and investigation

The result view presents event rows together with a time chart and a result count. A chart series can become a real filter, which keeps the chart and table focused on the same events. A row can open a side panel with an overview, column values, trace context, service context, or session context. The panel can also create a new search from a field value or open a linked trace.

Nested fields selected from a row remain usable in later searches and in the result table. Shared path and alias rules keep Map keys readable without changing the query when an alias could collide with a real column or another selected field.

Trace IDs use the same explorer surface as ordinary searches. The trace route redirects into search with a trace-specific condition, so trace investigation shares source selection, time control, filtering, and row details with log exploration. Session discovery uses the same query model and ClickHouse renderer before it presents replayable sessions; see Trace investigation and Session replay and exploration.

References: packages/…/DBTimeChart.tsx• L97-132 packages/…/DBSqlRowTableWithSidebar.tsx• L60-151 packages/…/DBRowSidePanel.tsx• L87-139 packages/…/utils.ts• L1169-1273 packages/…/[traceId].tsx• L8-28 packages/…/directTrace.ts• L3-21

Query translation

The query path separates what the user asks for from the SQL that ClickHouse executes. The source describes the table and telemetry expressions; the search configuration adds the current condition, filters, columns, ordering, and time range. Shared utilities then translate that complete description into a query and parameter set.

Query languages and parsing

Lucene is parsed into an abstract syntax tree, which is a structured representation of the expression. The serializer resolves fields through source metadata and chooses a ClickHouse predicate that matches the field type. It supports exact values, text matches, wildcards, existence checks, ranges, negation, and Boolean groups. Unknown fields become a no-match condition instead of silently matching unrelated data.

Lucene variable references also pass through this path. A quoted field reference such as Field:"$var" becomes a grouped exact-value condition for the selected values, while an unquoted reference keeps the normal field-search behavior. SQL conditions remain SQL expressions, but the same query path still adds them to the source and time constraints. The UI uses the same parser to explain Lucene input and to validate saved conditions before they are reused.

References: packages/…/queryParser.ts• L32-103 packages/…/queryParser.ts• L1999-2185 packages/…/variables.ts• L690-854 packages/…/renderChartConfig.ts• L1211-1285 packages/…/filters.ts• L495-649 packages/…/filters.ts• L660-763

Search configuration assembly

buildSearchChartConfig is the shared boundary between a saved-search-shaped request and the chart query model. It selects the source table, default event columns, timestamp expression, implicit text field, user filters, and optional ordering or time range. The app search page and server-side search paths use this boundary so the same search has the same intended row set across product surfaces.

The renderer then combines the parts of the model into one ClickHouse statement. It applies the time predicate, the main condition, filter conditions, grouping, sorting, and result limits in a known order. Dashboard variables are expanded before expressions are rendered, which lets a query carry a selected value from a dashboard filter without changing the query model itself.

Shared chart rules also adapt the model to the result shape. Categorical charts use a row limit and a stable value ordering, number charts remove time and group dimensions, and table charts use a bounded default with stable ordering. These rules keep the in-app and server-side views of the same chart aligned.

References: packages/…/searchChartConfig.ts• L58-83 packages/…/searchChartConfig.ts• L105-186 packages/…/renderChartConfig.ts• L1287-1463 packages/…/renderChartConfig.ts• L2757-2867 packages/…/search.ts• L81-170 packages/…/utils.ts• L62-68 packages/…/utils.ts• L951-1052

Prometheus metric evaluation

Metric queries use shared PromQL rules to turn chart settings into the right evaluation request. A metric chart can hold several expressions when its display supports multiple time series; other displays use the first non-empty expression. Range queries produce samples over time, while number displays can use an instant result or reduce a range to one value.

The same rules remove blank editor rows before a request reaches Prometheus and apply a default reducer when a number display needs one value. Range queries use the selected explorer granularity as the Prometheus step. Automatic or unknown granularity falls back to a date-range-derived step when possible, then to one minute, so the chart still has a valid time resolution.

The Prometheus API route resolves each metric source to its team-owned connection and table before it evaluates the request. A Prometheus-backed connection uses the standard Prometheus API; a ClickHouse connection uses its native Prometheus handler when available, then falls back to a ClickHouse table-function query. This lets one chart model work with both backend types.

References: packages/…/promql.ts• L15-63 packages/…/promql.ts• L65-134 packages/…/promql.ts• L202-244 packages/…/promqlChartQuery.ts• L1-120 packages/…/prometheus.ts• L139-175 packages/…/prometheus.ts• L576-771 packages/…/prometheus.ts• L782-904

SQL parameters and shared query utilities

The shared ClickHouse SQL utility represents a query as SQL text plus named parameters. Typed values such as strings, numbers, dates, intervals, and identifiers are passed separately from the statement text. This keeps user values out of SQL structure and gives the ClickHouse client the type information it needs.

Facet state becomes SQL conditions for the selected fields. The shared filter utility keeps included values, excluded values, and numeric ranges distinct; it also formats date values to match the source column type. Its parser can recover simple facet state from saved SQL, but it accepts a filter for the sidebar only when the displayed facet matches the full condition. This keeps the filter panel from hiding an extra condition that still affects execution.

The same query utility joins optional SQL fragments, renders time parameters for raw SQL charts, expands time and filter macros, and substitutes dashboard variables. Raw SQL remains an explicit escape hatch for trusted query structure; ordinary search and chart paths use the shared builders so filters and time bounds follow the same rules.

References: packages/…/index.ts• L166-307 packages/…/filters.ts• L30-175 packages/…/filters.ts• L495-649 packages/…/rawSqlParams.ts• L25-61 packages/…/macros.ts• L35-109 packages/…/variables.ts• L595-631

ClickHouse execution

After rendering, the explorer sends the SQL and its parameters to ClickHouse and turns the response into rows, metadata, counts, or chart data. The browser and API use the same base client contract, so connection settings, query limits, errors, and server features have one shared meaning.

Browser and server access

In the normal product mode, the browser sends queries to the authenticated ClickHouse proxy. The proxy finds the connection that belongs to the user's team, adds the stored credentials, checks the target path, and forwards the request. In local mode, the browser can connect to the configured local ClickHouse instance instead.

The explorer also carries query attribution, which identifies the product surface that started a request. The browser passes this context through the query client and the Prometheus route without making it part of the query identity. The server keeps its own request trace data, so execution reporting can distinguish surfaces without splitting shared result caches.

Server-side paths, such as the external search API and session queries, create the server client with the selected connection. PromQL requests use the same connection boundary, but can reach either a Prometheus endpoint or a Prometheus-compatible ClickHouse handler. Other paths still use the common renderer before execution. This keeps connection choice and query generation separate: the renderer describes the work, while the client or API route decides how to reach the data.

References: packages/…/clickhouse.ts• L23-61 packages/…/browser.ts• L108-203 packages/…/clickhouseProxy.ts• L164-241 packages/…/clickhouse.ts• L22-25 packages/…/search.ts• L105-155 packages/…/prometheus.ts• L69-81

Server capability detection

The shared ClickHouse layer checks the connected server version before it uses version-dependent query paths. For PromQL, the API also probes whether the Prometheus HTTP handler is actually configured. Only a server that passes both checks uses the native handler; older or unconfigured servers use a compatible table-function path instead of receiving a request they cannot run.

Time-series metadata also records the table version. This lets metric query paths account for schema changes while keeping the version lookup cached for the connection and table.

References: packages/…/clickhouseVersion.ts• L8-183 packages/…/metadata.ts• L630-653 packages/…/prometheus.ts• L349-389 packages/…/prometheus.ts• L619-650

Result streaming and query windows

Large result sets are read as a stream and exposed to the UI as data arrives. For long time ranges, compatible builder queries can run in smaller time windows; the client merges those windows while preserving the result order. Row tables use offset pagination within a window and then move to the next window, so scrolling can request more data without loading the complete range at once.

Raw SQL and PromQL tables do not paginate because their results may not have a stable order for offset-based continuation. Query timeouts and request abort signals stop work that exceeds the configured limit. The query cache keys results by the query configuration and relevant execution options, so a changed source, time range, condition, or filter creates a distinct result.

References: packages/…/useChartConfig.tsx• L137-465 packages/…/useOffsetPaginatedQuery.tsx• L123-173 packages/…/useOffsetPaginatedQuery.tsx• L195-450 packages/…/useOffsetPaginatedQuery.tsx• L470-567 packages/…/DBRowTable.tsx• L1600-1625

The explorer is the shared base for several investigation flows. Read the focused pages for the product goals and user journey of each area:

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the URL search state, saved-search fields, and SearchChartConfigInput aligned. A field accepted in one surface but omitted in another can produce a search that looks saved but runs differently.
  • Keep source changes aligned with filter and group-by reconciliation. A source switch must not keep controls that the new schema cannot query.
  • Keep clean UI filter keys separate from quoted ClickHouse keys. Changes to facet discovery, URL persistence, or filter rendering must preserve both forms.
  • Keep facet load-more state tied to the source, time range, condition, and filter state that produced it. Otherwise values from an old query can appear in a new one.
  • Keep nested JSON, Map, and array paths aligned with the type of the source column. Numeric-looking Map keys must remain string keys and must not become array positions.
  • Keep filter parsing aligned with filter rendering. A saved condition that partially parses must not appear as if its full predicate is represented by the sidebar.
  • Keep date filter values aligned with the source date type. A change to field metadata must not turn a valid date selection into a bare string comparison.
  • Keep Lucene serializer field-type rules aligned with autocomplete metadata. A field that the UI suggests but the renderer cannot resolve gives a misleading search experience.
  • Keep ClickHouse capability thresholds aligned with the query paths that use them. A server-version change can select a path that the connected server does not support.
  • Keep browser proxy headers and server connection lookup aligned with connection identity. A query can reach the wrong database if the connection header or proxy lookup changes independently.
  • Keep query-cache keys aligned with all inputs that affect SQL. A missing query-key field can display data from an earlier source or filter state.
  • Keep pagination support aligned with result ordering. Raw SQL and PromQL must not gain offset pagination unless their result order is stable and continuation is defined.

Important failure modes

TriggerConsequenceGuard
A source changes and an old filter field is keptClickHouse rejects the query or the result no longer represents the visible filter stateReconcile filters against the new source columns before the next run
A facet uses a clean UI key where a quoted SQL expression is requiredA nested field lookup reads the wrong value or fails to runKeep the UI key and its source-aware SQL expression separate
Extra facet values from an earlier query remain after the source or filter scope changesThe panel offers values that do not belong to the current result setClear load-more values when the query scope changes
A nested Map key looks numeric but is rendered as an array indexClickHouse rejects the expression or reads a different valueKeep Map paths as quoted string-key subscripts
A saved SQL filter contains a facet clause plus another hidden top-level conditionThe sidebar shows only part of the predicate while execution uses all of itAccept pinned-filter rendering only when the condition round-trips as one complete clause
A date field is compared with a bare stringClickHouse rejects the comparison or applies the wrong type conversionFormat date values to the source column type before building the condition
A Lucene field does not exist in source metadataThe search can return no rows instead of exposing a misleading broad matchResolve fields through metadata and use a no-match predicate
A query runs over a large rangeThe request can time out or hold too many rows in memoryUse time-window chunking, streaming, and row pagination where the query shape allows it
A ClickHouse server has the needed version but its Prometheus HTTP handler is not configuredA native PromQL request fails even though the version check passesProbe the handler and use the table-function path when it is unavailable
Offset pagination is applied to raw SQL or PromQL resultsRows can be skipped, repeated, or shown in an unstable orderKeep those result types to one page until a stable continuation rule exists
A previous result is retained for a query with different columns or filtersRows from an earlier query appear under the wrong display statePreserve earlier data only for an explicitly compatible refresh
A ClickHouse response fails during streamingPartial progress remains as if it were a complete resultRemove the in-progress result and surface the query error

Key files

FileWhy to read it
packages/…/DBSearchPage.tsxMain search lifecycle: URL state, saved searches, source changes, time range, chart config, and investigation actions
packages/…/DBSearchPageFilters.tsxUser-facing facets, value and range filters, columns, distributions, and pinned filters
packages/…/hooks.tsSource-aware facet discovery, table fallbacks, quoted keys, and load-more scope
packages/…/SearchWhereInput.tsxShared SQL/Lucene input contract and language switching
packages/…/searchFilters.tsxFilter state lifecycle and conversion between UI and persisted query forms
packages/…/queryParsers.tsURL-safe string and JSON state parsing for searches, filters, and linked views
packages/…/filters.tsFilter state conversion, condition parsing, date handling, and validation of saved filter expressions
packages/…/searchChartConfig.tsShared assembly of source and search settings into a chart query model
packages/…/queryParser.tsLucene parsing and conversion of search terms into ClickHouse predicates
packages/…/renderChartConfig.tsShared rendering of chart and search configuration into SQL
packages/…/index.tsParameterized SQL type, shared ClickHouse client contract, and query execution wrapper
packages/…/useChartConfig.tsxBrowser query lifecycle, streaming chunks, and chart result caching
packages/…/useOffsetPaginatedQuery.tsxRow-table execution, time-window pagination, query attribution, and streaming row assembly
packages/…/clickhouseProxy.tsAuthenticated connection lookup and browser-to-ClickHouse proxy boundary
packages/…/prometheus.tsPromQL routing across Prometheus and ClickHouse-backed metric sources
packages/…/sessions.tsExample of session queries built with the common renderer and client