-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auto
interval to histogram AggConfig
#76001
Conversation
@elasticmachine merge upstream |
I have reviewed the code and submitted a PR to you to change the layout and defaults to what makes sense to me: https://github.com/alexwizp/kibana/pull/4/files The main changes are:
|
@wylieconlon I've reviewed your changes but if I don't understand the benefits of adding one more configuration property. I'm about |
Pinging @elastic/kibana-app (Team:KibanaApp) |
@elasticmachine merge upstream |
src/plugins/data/common/search/aggs/buckets/_interval_options.ts
Outdated
Show resolved
Hide resolved
src/plugins/vis_default_editor/public/components/controls/number_interval.tsx
Outdated
Show resolved
Hide resolved
src/plugins/vis_default_editor/public/components/controls/number_interval.tsx
Outdated
Show resolved
Hide resolved
src/plugins/vis_default_editor/public/components/controls/number_interval.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Checked locally in Chrome, works fine
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't merge yet, the algorithm for selecting intervals doesn't look right.
src/plugins/data/common/search/aggs/buckets/lib/histogram_calculate_interval.test.ts
Outdated
Show resolved
Hide resolved
return interval; | ||
}; | ||
|
||
const calculateAutoInterval = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions are not behaving the way I expected, as described here: #75438 (comment)
I'll comment separately with tweaks.
@elasticmachine merge upstream |
@alexwizp There are several differences between the algorithm you've implemented here and the one that I was expecting. The main one is that I'm optimizing to pick "simple" intervals which are multiples of 10, 2 or 5, while yours is not. So with your bucketing, CPU values are bucketed into intervals of 0.3: While mine is choosing 0.2: I'm also not having any special cases for integers vs floats, they should be treated identically from my perspective. |
…ulate_interval.test.ts Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
@wylieconlon Honestly I don't understand why we should pick "simple" intervals which are multiples of @lukeelmers could you please have a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are talking about an example above for me 0.3 and 0.2 both valid values for auto mode.
It makes sense to me that we'd make some attempt at providing "pretty" intervals when somebody selects auto
. IMO it's easier for someone to visually digest multiples of 10 (or 2, 5, 10) than another arbitrary interval.
Overall the code here LGTM & the math makes sense, however as @wylieconlon points out this isn't exactly the algorithm that he proposed in the issue... so if we want to deviate from that proposal I think we'd need to discuss further to make sure everyone is on the same page.
Otherwise, I'm comfortable with merging once this aligns with the original plan and we add a few more clarifying comments in the code.
return roundInterval(diff / bars); | ||
}; | ||
|
||
export const calculateHistogramInterval = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the type of code that can be really hard to maintain if you have to read through the math without any background and grok what's going on.
For future reference & to make maintenance easier, it would be great if we could add some detailed comments to each of the functions in this file, explaining the algorithm at a high level, what each function does, and why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I've added a textual description of @wylieconlon 's original algorithm 11f6ec8
Co-authored-by: Luke Elmers <lukeelmers@gmail.com>
Algorithm of @wylieconlon works better for some cases. I think we should choose it. Thank you again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with these changes once we get a green build, but please wait for a final LGTM from Wylie before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM!
src/plugins/data/common/search/aggs/buckets/lib/histogram_calculate_interval.ts
Outdated
Show resolved
Hide resolved
…ulate_interval.ts Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
async chunks size
page load bundle size
oss distributable file count
distributable file count
History
To update your PR or re-run it, just comment with: |
* Add `auto` interval to histogram AggConfig Closes: elastic#75438 * fix JEST * update UI * add tests * some changes * small changes * cleanup code * fix PR comment * fix PR comments * fix PR comment * Update src/plugins/data/common/search/aggs/buckets/lib/histogram_calculate_interval.test.ts Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> * Change algorithm for auto interval * Update src/plugins/data/common/search/aggs/buckets/histogram.ts Co-authored-by: Luke Elmers <lukeelmers@gmail.com> * added some comments * Update src/plugins/data/common/search/aggs/buckets/lib/histogram_calculate_interval.ts Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> Co-authored-by: Luke Elmers <lukeelmers@gmail.com>
* Add `auto` interval to histogram AggConfig Closes: #75438 * fix JEST * update UI * add tests * some changes * small changes * cleanup code * fix PR comment * fix PR comments * fix PR comment * Update src/plugins/data/common/search/aggs/buckets/lib/histogram_calculate_interval.test.ts Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> * Change algorithm for auto interval * Update src/plugins/data/common/search/aggs/buckets/histogram.ts Co-authored-by: Luke Elmers <lukeelmers@gmail.com> * added some comments * Update src/plugins/data/common/search/aggs/buckets/lib/histogram_calculate_interval.ts Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> Co-authored-by: Luke Elmers <lukeelmers@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> Co-authored-by: Luke Elmers <lukeelmers@gmail.com>
* master: (223 commits) skip flaky suite (elastic#75724) [Reporting] Add functional test for Reports in non-default spaces (elastic#76053) [Enterprise Search] Fix various icons in dark mode (elastic#76430) skip flaky suite (elastic#76245) Add `auto` interval to histogram AggConfig (elastic#76001) [Resolver] generator uses setup_node_env (elastic#76422) [Ingest Manager] Support both zip & tar archives from Registry (elastic#76197) [Ingest Manager] Improve agent vs kibana version checks (elastic#76238) Manually building `KueryNode` for Fleet's routes (elastic#75693) remove dupe tinymath section (elastic#76093) Create APM issue template (elastic#76362) Delete unused file. (elastic#76386) [SECURITY_SOLUTION][ENDPOINT] Trusted Apps Create API (elastic#76178) [Detections Engine] Add Alert actions to the Timeline (elastic#73228) [Dashboard First] Library Notification (elastic#76122) [Maps] Add mvt support for ES doc sources (elastic#75698) Add setHeaderActionMenu API to AppMountParameters (elastic#75422) [ML] Remove "Are you sure" from data frame analytics jobs (elastic#76214) [yarn] remove typings-tester, use @ts-expect-error (elastic#76341) [Reporting/CSV] Do not fail the job if scroll ID can not be cleared (elastic#76014) ...
Closes: #75438
Summary
What was done it that PR:
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.
Add support for intervals which less than 1. Based on Add
auto
interval to histogram AggConfig #75438 (comment)Set Auto mode as a default for new aggregations in Vis Editor
Before:
After:
Checklist
Delete any items that are not applicable to this PR.
For maintainers