feat(api-gateway): granularities config and /v1/granularities endpoint#10918
Open
igorlukanin wants to merge 2 commits into
Open
feat(api-gateway): granularities config and /v1/granularities endpoint#10918igorlukanin wants to merge 2 commits into
igorlukanin wants to merge 2 commits into
Conversation
02bf1d7 to
b7ac787
Compare
b7ac787 to
898dec8
Compare
898dec8 to
19ef48a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10918 +/- ##
==========================================
+ Coverage 78.93% 83.53% +4.59%
==========================================
Files 470 254 -216
Lines 92868 75869 -16999
Branches 3450 0 -3450
==========================================
- Hits 73307 63377 -9930
+ Misses 19056 12492 -6564
+ Partials 505 0 -505
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Engine-side foundation for configurable, deployment-wide granularities:
granularitiesshape on time dimensions. Accepts a dict{ includes?, excludes?, custom? }alongside the legacy flat array.includes/excludes(string list or'*') select from the enabled set;customdefines per-dimension granularities. Mutually exclusive except forincludes: '*' + excludes: [...].CUBEJS_GRANULARITIES(comma-separated list), per-custom env varsCUBEJS_GRANULARITIES_<NAME>_INTERVAL|TITLE|OFFSET|ORIGIN, orconfig.granularities(list or context-dependent function). File config fully replaces env vars.GET /v1/granularities. New read-only endpoint returning the resolved set (built-ins + customs) for the request's security context./v1/metaenrichment. Each time-dimension granularity now carriestype('built-in'/'custom'),title,format(d3-time-format), andinterval. Per-dimensionincludes/excludesare resolved against the deployment config so the response reflects the effective set./v1/load+/v1/cubesqlannotations. Sametype/formatenrichment flows throughprepareAnnotationto query responses.Granularity/GranularityAnnotationand the Rust transport struct in@cubejs-backend/nativenow carrytypeandformat.Out of scope (separate follow-ups):
allow_no_granularityparameter end-to-endTest plan
granularities-shape.test.ts) and global config precedence (granularities-config.test.ts).cube-validator.test.tsfor the new dict shape: includes/excludes mutual-exclusion, built-in shadowing, legacy form acceptance.prepare-annotation.test.tsfor the newtype/formatfields on the granularity annotation./v1/granularitiesreturns 8 built-ins + customs sourced fromCUBEJS_GRANULARITIES./v1/metafor a time dim withgranularities: { includes: ['year', 'quarter'], custom: [...] }returns exactly those built-ins plus the local custom; a dim with the legacy flat array gets all enabled built-ins plus its locals./v1/loadwithgranularity: 'week'returns{ type: 'built-in', title: 'Week', interval: '1 week', format: '%b %-d, %Y' }.