Skip to content

feat: approximate-by-default measures with exact_expression and an inline exact chip - #10032

Open
nishantmonu51 wants to merge 4 commits into
mainfrom
nishant/approx-exact-measures
Open

nishantmonu51 wants to merge 4 commits into
mainfrom
nishant/approx-exact-measures

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator

Measures can define an exact_expression next to their approximate expression, and dashboards let viewers switch a measure to its exact value on demand.

  • Runtime: exact_expression on measures (parsed, validated, in the reference docs); exact on MetricsViewAggregationMeasure and exact_measure_names on MetricsViewTimeSeriesRequest. The executor resolves the exact set once per query (closure over referenced measures) and passes it to every rewrite and AST; rollups are skipped for exact queries; rill.metrics.exact_measures is a kill switch. The AI query_metrics_view tool exposes the flag.
  • Explore: a ≈/= chip next to measures with an exact variant on big numbers, leaderboard and dimension table headers, the TDD header and table, and pivot column headers. A chip switches its own surface only (the big-number row, one leaderboard, the dimension table, the TDD table or the pivot). The selection is tab memory, never written to the URL, and resets when filters, time controls or the view change. One-shot exports follow what is on screen.
  • Canvas: the same chip per KPI and per table, pivot and leaderboard column, plus one chip next to a chart's title that switches every measure of the chart. The selection is per widget and resets when the canvas URL params change.
  • Docs: exact_expression in the measures reference, a guide page for the chip, and the canvas widget docs.
  • Tests: Go tests for parsing, AST, executor, rollups, validation and queries; vitest for the selection logic and the surfaces; a web-local e2e spec on a new AdBids_exact_metrics fixture.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

…inline exact chip

Measures can define an `exact_expression` next to their approximate `expression`.
Queries flag measures with `exact`; the runtime resolves the exact set once per
query, skips rollups for it and honours the `rill.metrics.exact_measures` kill
switch. Explore and canvas dashboards show a `≈`/`=` chip next to such measures
and keep the selection in tab memory, per surface (one chip per chart in canvas).
@nishantmonu51
nishantmonu51 requested a review from pjain1 October 17, 2026 17:35
@AdityaHegde
AdityaHegde self-requested a review October 20, 2026 05:41

@AdityaHegde AdityaHegde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High level review, just one comment about executor code.

return nil, err
}

exactMeasures, err := e.resolveExactMeasures(qry)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing around exact measures everywhere how about running a rewrite at once place? Not sure if there is a good path for this.

- match the Connect `MetricsViewAggregation` endpoint instead of the REST path
- give the `publishers` measure a deterministic default expression
- rename the fixture to `AdBids_precision_metrics` so that it sorts after `AdBids_metrics` and does not become the canvas editor's default metrics view
…measures

# Conflicts:
#	proto/gen/rill/runtime/v1/resources.pb.go

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants