Repository navigation
feat: metrics view time_grains with minute and hour multiples - #10080
Open
nishantmonu51 wants to merge 1 commit into
Open
nishantmonu51 wants to merge 1 commit into
nishantmonu51 wants to merge 1 commit into
Conversation
Lets a metrics view declare the grains its dashboards offer, including multiples of minutes and hours (5m, 10m, 15m, 30m, 2h, 3h, 4h, 6h, 8h, 12h): - `TimeGrain` enum gains the ten multiples; `MetricsViewSpec.time_grains` carries the declared list, parsed from `time_grains: [10m, hour, day]` - Multiples bucket on the local wall clock in every dialect (DuckDB `time_bucket`, ClickHouse `toStartOfInterval`, Druid `time_floor`, Databricks/BigQuery floor-within-parent, Snowflake `TIME_SLICE`, StarRocks `time_slice`, Pinot `DATETIMECONVERT`); spine bins, null filling, comparison offsets and rollup derivability understand them - `smallest_time_grain`, rollups and selectors stay standard-only - Explore, TDD, pivot, scheduled reports and canvas pickers list only the declared grains; adaptive mode picks among them; the grain travels as `grain=10m` in URLs, presets, component `time_filters` and resolver queries, and round-trips through bookmarks - Docs, JSON schema, AI tool text, golden resolver tests, unit tests and Playwright specs for explore and canvas
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
time_grainsto metrics views so a project can declare the grains its dashboards offer, including sub-hour and multi-hour buckets.time_grainslist on a metrics view replaces the default grain set in explore (chart, TDD, pivot, scheduled reports) and canvas (filter bar, widget inspector). Omitting it keeps today's behavior: the standard grains at or abovesmallest_time_grain.TimeGrainmultiples join the catalog:5m,10m,15m,30m,2h,3h,4h,6h,8h,12h. Each divides its parent unit, so buckets stay aligned to local midnight in the query timezone. The canonical token (10m) is accepted by resolver queries, metrics SQL (date_trunc('10m', ts)), explore URLs (grain=10m), canvastime_filtersandadditional_time_grain.time_bucket, ClickHousetoStartOfInterval, Druidtime_floor, SnowflakeTIME_SLICE, StarRockstime_slice, PinotDATETIMECONVERT, and floor-within-parent expressions for Databricks and BigQuery. Spine bins, legacy time-series null filling, comparison offsets and rollup derivability handle them.smallest_time_grain, rolluptime_grainandrequires/per/window.orderselectors reject them at parse time. The list is a UI contract and is not enforced on API queries, same assmallest_time_graintoday.time_grainsreference entry and a "Custom time grains" section in the time series guide.Not included: a multi-select for
time_grainsin the visual metrics editor. For frontend reviewers: protobuf-es stops stripping theTIME_GRAIN_prefix once a value such asTIME_GRAIN_5_MINUTEexists, so the TS proto enum is now referenced asTimeGrain.TIME_GRAIN_DAY.Checklist: