Metric exploration
Metric exploration helps an engineer find a metric from a source, understand its meaning and attributes, and turn it into a chart or PromQL visualization. The experience joins metric discovery with chart authoring, query execution, query preview, and dashboard use.
Metric discovery
Metric discovery narrows the names reported by a source into a metric series that a chart can query. The catalog supports broad inspection, while the editor's selector supports quick changes during chart work.
Metric catalog
The metric catalog shows recent metrics from the selected source. It combines supported gauge, sum, histogram, and exponential histogram entries with their name, kind, unit, and description when available. Summary metadata may be labeled by the catalog but is not part of the current metric chart path.
The catalog uses the source connection, database, metric tables, timestamp expression, and a bounded recent range. It loads each metric kind separately, so one failed kind can leave a partial catalog. The browser distinguishes an empty source from a catalog request that failed.
References: packages/…/useMetricCatalog.ts• L24-64 packages/…/useMetricCatalog.ts• L72-118 packages/…/useMetricCatalog.ts• L174-211 packages/…/types.ts• L5-13
Metric browser
The metric browser presents names in a tree or a flat list. Tree view groups names by prefix. List view shows full names in an alphabetical searchable list. Search checks names and descriptions, and the selected layout persists for later use.
Selecting a metric opens its detail view. A direct apply action commits the metric to the chart series. Tree search can limit the number of shown matches, so the browser reports when the result is incomplete. It also reports partial catalog failure instead of treating missing kinds as missing metrics.
References: packages/…/MetricBrowser.tsx• L30-58 packages/…/MetricBrowser.tsx• L68-162 packages/…/MetricNameTree.tsx• L24-34 packages/…/MetricFlatList.tsx• L24-47 packages/…/metricNameTree.ts• L69-85
Metric selection
The chart editor treats a metric name and kind as one selection because one name can occur in more than one metric table. Its lightweight selector starts with names from the source index and searches metric tables when the engineer types. It uses a bounded result page and asks for a narrower search when more matches exist.
The selector keeps a configured metric visible even when it is outside the current search results. It can also accept a typed name with no recent data, but only for metric kinds that the source can query. Applying a browser choice resets the value expression and aggregation to kind-appropriate defaults, then replaces filters and groupings staged for the old metric.
References: packages/…/MetricNameSelect.tsx• L17-49 packages/…/MetricNameSelect.tsx• L76-152 packages/…/MetricNameSelect.tsx• L154-237 packages/…/ChartSeriesEditor.tsx• L114-152 packages/…/MetricExplorerModal.tsx• L117-154
Metric detail
Metric detail explains the selected metric before it becomes a chart query. It combines descriptive metadata with observed services and attributes so the engineer can decide how to filter or group the series.
Metric metadata
Metric metadata describes the value represented by a metric. The detail view shows its kind, description, unit, and a bounded sample of service names. The chart editor also shows this context below a metric series, which keeps the meaning available during edits. The attribute helper keeps the same context visible in its collapsed summary.
References: packages/…/MetricDetailPanel.tsx• L107-155 packages/…/MetricAttributeHelperPanel.tsx• L403-470 packages/…/useFetchMetricMetadata.tsx• L12-26 packages/…/useFetchMetricMetadata.tsx• L48-85
Metric attributes
Metric attributes are tags attached to metric points. The explorer groups them as Resource, Attributes, and Scope data. An engineer can search the tag list and open the observed values for one tag. The detail panel can show these tags as a read-only view or expose actions that add a filter or group-by clause to the chart editor.
Attribute lookup is scoped to the selected metric name and kind. Value search returns a bounded ordered set of non-empty values. An empty tag list or value list means that no matching observations were found; it does not mean that the metric is missing. Changing the selected metric resets an open attribute-value view so values from the old metric do not remain visible.
References: packages/…/MetricAttributeHelperPanel.tsx• L312-401 packages/…/MetricDetailPanel.tsx• L57-67 packages/…/MetricDetailPanel.tsx• L169-195 packages/…/useFetchMetricResourceAttrs.tsx• L14-21 packages/…/useFetchMetricResourceAttrs.tsx• L142-197 packages/…/useFetchMetricAttributeValues.tsx• L14-24 packages/…/useFetchMetricAttributeValues.tsx• L57-111
Attribute selection
An observed attribute value can become a filter for the selected series. An attribute can also become a group-by expression when the chart supports grouping. The helper formats the filter in the selected series query language, while the chart-level group-by remains SQL because it describes the result shape.
The browser stages these actions until the engineer applies the metric. Applying the metric writes the staged clauses into the chart form and runs the shared chart query path. Changing the metric clears staged clauses so tags from the previous metric cannot constrain the new one.
The flow from an observed tag to a chart query is:
flowchart LR
A[Select metric] --> B[Load attributes]
B --> C[Select attribute]
C --> D[Load values]
D --> E[Stage filter or group-by]
E --> F[Apply metric]
F --> G[Run chart query]
References: packages/…/MetricAttributeHelperPanel.tsx• L183-229 packages/…/MetricAttributeHelperPanel.tsx• L142-163 packages/…/MetricExplorerModal.tsx• L125-154 packages/…/ChartSeriesEditor.tsx• L190-269
Metric meaning
Metric kind and unit describe the data contract behind a value. The editor uses kind to choose a valid aggregation, while unit helps the engineer read the result.
Metric kinds
The product recognizes Gauge, Sum, Histogram, Exponential histogram, and Summary kinds. The metric chart path queries Gauge, Sum, Histogram, and Exponential histogram tables. Summary is catalog metadata only in this path.
The editor starts each kind with a useful aggregation and removes choices that do not apply:
| Kind | Starting aggregation | Other supported views |
|---|---|---|
| Gauge | Average | Delta mode |
| Sum | Sum | Increase for counter-like sums |
| Histogram | 95th percentile | Count and percentile |
| Exponential histogram | 95th percentile | Count and percentile |
When the kind changes, the editor resets an invalid aggregation. This keeps the chart query aligned with the selected metric table.
References: packages/…/types.ts• L5-13 packages/…/metricKinds.ts• L8-26 packages/…/AggFnSelect.tsx• L10-37 packages/…/AggFnSelect.tsx• L82-98 packages/…/ChartSeriesEditor.tsx• L114-152
Metric units
Metric units use UCUM codes, which are standard unit codes. The browser uses compact forms where space is limited. The detail view expands known time, data, frequency, temperature, percentage, count, and physical-unit codes. It also expands compound units such as By/s; unknown codes remain visible instead of receiving an invented meaning.
The unit explains the stored value but does not change it. Number formatting is a separate chart display choice. The editor can also detect a format from the selected data source when no explicit format is set.
References: packages/…/MetricAttributeHelperPanel.tsx• L55-140 packages/…/MetricAttributeHelperPanel.tsx• L445-455 packages/…/MetricDetailPanel.tsx• L127-140 packages/…/EditTimeChartForm.tsx• L405-417
Query authoring
Metric visualizations can use a structured builder or a PromQL expression. The builder exposes metric-aware fields and attribute helpers. PromQL gives direct control over a Prometheus query. Both paths feed the same chart editor and preview model.
Metric builder workflow
The builder turns a source, metric series, aggregation, conditions, and grouping into a chart query. A metric source uses the metric's value expression and applies series conditions to metric attributes. Multiple series can form a ratio, and supported displays can add formula series derived from the series inputs.
The main workflow is:
- Select a metric source.
- Choose a metric in the selector or open the browser.
- Review the kind, unit, description, and attributes.
- Choose an aggregation and any delta or percentile option.
- Add filters, grouping, a ratio, or a formula when the display supports it.
- Run the query and inspect the preview.
- Save the chart or add it to a dashboard.
The chart-level group-by suggestions are valid across every metric series in the chart. This matters for ratios and multi-series charts because their metric tables can expose different fields.
References: packages/…/ChartSeriesEditor.tsx• L206-245 packages/…/ChartSeriesEditor.tsx• L353-537 packages/…/ChartEditorControls.tsx• L166-183 packages/…/ChartEditorControls.tsx• L283-500 packages/…/utils.ts• L469-516 packages/…/renderChartConfig.ts• L1832-1911
PromQL workflow
PromQL mode is for sources that expose a Prometheus query interface. The editor provides syntax-aware expression editing, metric and function completion, aliases, and dashboard variable support. Metric completion comes from the source's metric-name labels and is offered only when the selected source is PromQL-compatible.
A chart can hold one expression or a list of expression rows. Each row can have an alias and can be moved, copied, or removed. Time series displays can add and query several expressions up to the editor limit. Other displays can keep extra rows for editing, but mark rows after the first as not queried and execute only the first non-blank row. Older saved charts with one expression are normalized to the same row model as newer charts. Blank rows stay in the saved form so an unfinished row is not lost, but they are skipped during execution.
PromQL series use range queries by default. Number, table, bar, and pie displays can choose an instant query. Number, bar, and pie displays can also reduce samples to one value with a reducer. The chart's effective granularity controls the Prometheus step, and the source can impose a minimum step. When a display does not support a query type or reducer, the editor drops that field from the queried and saved chart configuration instead of carrying stale behavior.
The editor offers completion only after a Prometheus-compatible source is selected. It also supports chart macros such as the interval, range, and rate interval values. The same expression and chart flow can use a native Prometheus-compatible source or a ClickHouse-backed source that returns Prometheus-shaped results.
References: packages/…/PromqlChartEditor.tsx• L31-167 packages/…/PromqlExpressionEditor.tsx• L10-89 packages/…/types.ts• L17-45 packages/…/utils.ts• L490-600 packages/…/promql.ts• L20-76 packages/…/promql.ts• L225-252
Query mode transition
The editor offers Builder, SQL, and PromQL modes when the selected display supports them. Builder state can carry into a macro-based SQL template. PromQL remains an expression-based path rather than a conversion of builder fields.
Changing mode or display type can invalidate the current source and fields. The editor selects a valid source when required, resets fields that do not apply, and keeps the saved mode with the chart so later rendering uses the matching query path.
References: packages/…/EditTimeChartForm.tsx• L327-349 packages/…/EditTimeChartForm.tsx• L745-849 packages/…/EditTimeChartForm.tsx• L1016-1027 packages/…/useBuilderToSqlConversion.ts• L61-72
Heatmap modes
Metric data can use a heatmap in Series or Distribution mode. Series mode shows one row per group and follows the normal time-series path. Distribution mode buckets events by a value expression and uses a count expression for bucket intensity. Trace sources can use duration as the distribution value.
PromQL heatmaps add Histogram mode. Histogram mode treats each Prometheus le bucket as a row and displays the value for that bucket. PromQL distribution mode buckets samples from every series rather than events from a builder source.
Changing heatmap mode applies the matching source, series, and number-format defaults. A builder heatmap does not offer Histogram mode. A PromQL heatmap uses the first expression only.
References: packages/…/HeatmapModeControl.tsx• L5-48 packages/…/HeatmapSeriesEditor.tsx• L49-155 packages/…/EditTimeChartForm.tsx• L164-211 packages/…/EditTimeChartForm.tsx• L319-334 packages/…/EditTimeChartForm.tsx• L879-908 packages/…/utils.ts• L576-600
Query and visualization preview
The preview connects chart settings to the result that the engineer will save. The editor runs only a submitted configuration, then uses that same query state for the visualization and generated query explanations.
Query readiness
The preview needs a complete query before it can show data:
- Builder mode needs a select definition, database, table or metric tables, and a timestamp expression.
- SQL mode needs a SQL template and connection.
- PromQL mode needs at least one non-blank expression that the selected display will query and a connection.
Markdown is static content, so it has no Run action, time range, dashboard filter block, or data query. Querying displays show a prompt until the engineer defines the chart and selects Run.
When dashboard filter application is enabled, missing required selections block the preview. The preview applies filters and variables to the submitted source and configuration, not to live edits that have not been run. An alert disables dashboard filter application because alert evaluation does not use those selections.
References: packages/…/utils.ts• L63-84 packages/…/utils.ts• L144-151 packages/…/utils.ts• L218-261 packages/…/ChartPreviewPanel.tsx• L199-271 packages/…/EditTimeChartForm.tsx• L457-531
Visualization preview
After a query runs, the preview selects the visualization for the active display type. It can show time series, table, number, bar, pie, heatmap, search, or event-pattern results where the query mode supports that display. Table sorting updates the chart form and runs the query again.
Metric queries most often feed time series or number displays, but grouping can also produce table and categorical views. Ratios and formulas shape the query result before display settings control presentation. Distribution heatmaps run a bounds query before the bucket query. Series heatmaps run one time-series query. PromQL histogram heatmaps use the histogram bucket labels as their vertical rows.
References: packages/…/ChartPreviewPanel.tsx• L67-159 packages/…/ChartPreviewPanel.tsx• L254-462 packages/…/ChartEditorControls.tsx• L166-173 packages/…/HeatmapModeControl.tsx• L20-35
Generated query preview
Builder charts expose generated SQL. PromQL charts expose the expressions after the same variable and macro substitution used for execution. The generated sections remain disabled until a matching query has run, and PromQL expressions are shown one per preview with aliases when present.
The preview uses the queried source's granularity rules, date range, variables, and display conversion. If expression substitution fails, it shows the error instead of displaying a template that did not run. Distribution heatmaps show their bounds and bucket queries separately because the second depends on the first. Series heatmaps show one query, while PromQL histogram heatmaps do not use the builder SQL preview.
References: packages/…/ChartPreviewPanel.tsx• L85-163 packages/…/ChartPreviewPanel.tsx• L468-545 packages/…/utils.ts• L264-339 packages/…/utils.ts• L389-467 packages/…/EditTimeChartForm.tsx• L959-979 packages/…/promql.ts• L153-223
Visualization addition
Applying a metric writes the pending metric and attribute choices into the current chart series and runs the shared query path. Saving preserves the query mode and display settings, so the metric definition can become a dashboard tile. Canceling the browser leaves the last applied series unchanged.
The editor can also save a chart directly to a dashboard from its action menu. Dashboard layout, saved tile lifecycle, filters, and variables are covered in Dashboards and visualization.
References: packages/…/MetricExplorerModal.tsx• L45-58 packages/…/MetricExplorerModal.tsx• L151-223 packages/…/ChartActionBar.tsx• L228-255 packages/…/EditTimeChartForm.tsx• L665-713
Related exploration
Metric exploration uses the shared source, time range, filter, query, and execution model described in Explorer and query experience. Search and log workflows are described in Search and log exploration. Trace-specific investigation is described in Trace investigation. Session-focused exploration is described in Session replay and exploration. Saved chart use is described in Dashboards and visualization.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep metric name and kind paired across catalog results, selector state, staged browser actions, saved charts, and metric table selection.
- Keep supported metric kinds aligned across catalog loading, aggregation choices, form resets, validation, and query rendering.
- Keep staged filters and group-bys tied to the metric that produced them. A metric change must not retain old attributes.
- Keep group-by suggestions intersected across every metric series in a multi-series or ratio chart.
- Keep PromQL expression rows, display-specific expression count, query type, reducer, step, macros, and generated preview aligned with execution.
- Keep extra PromQL rows editable without querying them on displays that support only one expression. Keep blank rows in saved form state but skip them during execution.
- Keep query type and reducer fields limited to displays that support them in both saved and queried chart configs.
- Keep PromQL macros and variables expanded against the source and configuration that were actually queried, not a later live selection.
- Keep heatmap mode defaults, source restrictions, bounds queries, bucket queries, and generated SQL explanations aligned.
- Keep PromQL histogram mode separate from builder heatmap modes, and keep its source and first-expression rules aligned with the saved config.
- Keep preview readiness and required-filter blocking based on submitted configuration. Live edits must not change the meaning of the last run.
- Keep dashboard filter application separate from alert evaluation. Alerts must not inherit dashboard selections.
- Keep source-derived number-format fallback separate from an explicit user format, including when a format is cleared.
- Keep metric detail attribute actions read-only when callbacks are absent, and keep filter syntax separate from SQL group-by syntax.
- Reset the open attribute-value view when the selected metric or kind changes.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A metric kind is listed but has no configured table | The selector can offer a metric that cannot run | Limit typed offers and query choices to configured kinds |
| A metric switch retains old attribute clauses | The new metric can return no data or an invalid query | Clear staged filters and group-bys on metric change |
| A multi-series group-by uses a field from one metric table only | One query branch can fail | Suggest only fields present in every metric series |
| A PromQL row is blank or the display cannot show several expressions | The request or displayed result does not match the editor | Keep rows for editing, skip blank rows, and query only the expressions supported by the display |
| A PromQL query type or reducer remains on a display that cannot use it | The saved tile shows controls or query behavior that the display does not support | Drop unsupported fields when the form becomes a chart config |
| A PromQL source is not selected when completion or execution needs it | Metric completion is absent or the chart cannot run | Restrict source choices by mode and validate the resolved source |
| PromQL preview expands macros from the selected source instead of the queried source | The preview differs from the query that ran | Resolve macros with the submitted source and effective granularity |
| Required dashboard filters have no value | The preview can misrepresent a dashboard tile | Block the preview and name the missing filters, or turn off Apply filters |
| A chart has not been run | Generated SQL or PromQL can describe an unexecuted state | Disable generated previews until a matching query is submitted |
| A distribution heatmap skips its bounds query | Bucket boundaries are unavailable or incorrect | Resolve bounds before the bucket query and show both stages |
| A builder heatmap accepts PromQL histogram mode or a PromQL heatmap uses builder-only fields | The saved mode cannot produce the expected result | Restrict modes by config type and normalize fields before query execution |
| A display or source does not support a formula or ratio | The saved result shape cannot be rendered | Gate derived-series controls by source and display support |
| A detail view keeps a prior metric's selected tag | The engineer can inspect or apply values from the wrong metric | Key detail state by metric kind and name so the tag view resets |
| A filter action uses SQL syntax for a Lucene series | The generated series condition is invalid | Format filters from the selected language while keeping group-by clauses in SQL |
Key files
| File | Why to read it |
|---|---|
| packages/…/MetricBrowser.tsx | Shows catalog search, tree/list navigation, and partial-load states |
| packages/…/MetricDetailPanel.tsx | Presents metric meaning, services, tags, and detail-panel actions |
| packages/…/MetricExplorerModal.tsx | Connects pending metric and attribute choices to apply and cancel behavior |
| packages/…/MetricAttributeHelperPanel.tsx | Defines attribute browsing, values, units, and filter or group-by actions |
| packages/…/useMetricCatalog.ts | Defines recent catalog loading and metric-kind coverage |
| packages/…/MetricNameSelect.tsx | Provides the editor's bounded metric name and kind search |
| packages/…/ChartSeriesEditor.tsx | Connects metric selection, aggregation, metadata, and series clauses |
| packages/…/ChartEditorControls.tsx | Coordinates series, formulas, ratios, grouping, and display limits |
| packages/…/EditTimeChartForm.tsx | Coordinates modes, source validity, submitted query state, filters, and preview |
| packages/…/ChartActionBar.tsx | Provides Run, time range, granularity, dashboard-filter, and save actions |
| packages/…/ChartPreviewPanel.tsx | Renders visualization results and generated SQL or PromQL explanations |
| packages/…/HeatmapModeControl.tsx | Defines the available builder and PromQL heatmap modes |
| packages/…/HeatmapSeriesEditor.tsx | Shows the builder fields for series and distribution heatmaps |
| packages/…/utils.ts | Defines query readiness, preview filter resolution, PromQL rendering, and explanation configs |
| packages/…/PromqlChartEditor.tsx | Provides PromQL source selection, expression rows, and display-aware expression controls |
| packages/…/PromqlExpressionEditor.tsx | Connects each PromQL expression to aliases, editing, ignored-row state, and query controls |
| packages/…/types.ts | Defines the shared form shape for builder, SQL, and PromQL chart modes |
| packages/…/utils.ts | Converts PromQL form rows and heatmap settings into query and saved-chart configs |
| packages/…/utils.test.ts | Verifies PromQL row normalization and display-specific query settings |
| packages/…/promql.ts | Defines executable PromQL series, query types, reducers, and chart steps |
| packages/…/renderChartConfig.ts | Defines how metric series, formulas, and chart displays become query work |
| packages/…/types.ts | Defines shared metric-kind and chart configuration contracts |