-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
Feature:AggregationsAggregation infrastructure (AggConfig, esaggs, ...)Aggregation infrastructure (AggConfig, esaggs, ...)enhancementNew value added to drive a business resultNew value added to drive a business result
Description
Since the histogram aggConfig does already do a preflight request to determine min and max to later make sure we're not running over the histogram:maxBars setting, we can use that min/max information to easily allow an auto interval option.
The following steps need to be made:
- Allow
autoas an allowedintervaloption (this shoul not require any changes by itself) - Add an option
autoIntervalTargetto thehistogramAggConfig and the corresponding expression function, that takes a number or undefined. This parameter should default if not specified to thehistogram:barTargetadvanced setting. - Adjust the logic of how the actual interval is calculated (see below)
- Add lots of tests
I think the way those parameters (interval, intervalBase, autoIntervalTarget) are playing together should be the following:
- If
intervalhas a value !==autoeverything should behave as beforehand:- If using that value would create too many buckets (higher than
histogram:maxBars), increase the interval. - Always make sure if
intervalBaseis set, that the used interval is a multiple ofintervalBase(this is required for rollups). autoIntervalTargethas no effect if it's set as long asinterval !== 'auto'
- If using that value would create too many buckets (higher than
- If
intervalis set toautodo the following:- Use the
max/minvalue (if they couldn't be loaded this request should fail altogether). - Check which interval we need to reach
autoIntervalTargetbuckets AND have a multiple ofintervalBase(if set) AND be a more or less roundish value (so we're not ending up with intervals of 146.12). cc @wylieconlon @lukeelmers interested to hear your opinion on what reasonable roundings could be here. We have similar code for the maxInterval check, not sure if that's the logic we want to keep. - Make the actual request with that
interval.
- Use the
One question for me would be: What happens if the autoIntervalTarget is larger than the histogram:maxBars defined in advanced settings? I see two solutions:
- Either set
autoIntervalTargettohistogram:maxBarsif it exceeds it, or - ignore
histogram:maxBarsin this case, since the "consumer" (e.g. the editor like Lens) explicitly set a higher value, but then again it would kind of render thehistogram:maxBarsuseless, if it's not really limiting max bars.
Would also be curious about your thoughts on that?
th0ger
Metadata
Metadata
Assignees
Labels
Feature:AggregationsAggregation infrastructure (AggConfig, esaggs, ...)Aggregation infrastructure (AggConfig, esaggs, ...)enhancementNew value added to drive a business resultNew value added to drive a business result