Skip to content
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

[Lens] Combined histogram/range aggregation for numbers #76121

Merged
merged 73 commits into from
Sep 23, 2020

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Aug 27, 2020

Summary

This PR introduces the combined histogram/range aggregation in Lens as a single operation.

  • When opening the panel the Granularity range input set to the middle of the range

Screenshot 2020-09-18 at 12 10 33

  • It is possible to manually change the Granularity level (now there are 7 "ticks" available)

Screenshot 2020-09-18 at 12 09 07

auto-ranges-tick

  • Or go fully manual and explicitly set each interval/range

Screenshot 2020-09-18 at 12 11 38

  • New range intervals will pick the previous value as new from value:

Screenshot 2020-09-18 at 12 11 59

  • In case the last range is "open" (the to value is +Infinity) then it's still ok:

Screenshot 2020-09-18 at 12 14 05

  • It is possible to drag and drop range intervals
    auto-ranges-dnd

  • An invalid range interval happens when from > to

Screenshot 2020-09-18 at 12 16 57

This PR is still a WIP, the full list of tasks to complete is the following:

  • Fixes
    • Make the range results render
      • Fix the x interval label formatting + tooltips
      • Fix the filtering selection issue
    • Make the Max bars work correctly => Now unified range input
    • Workout the correct step values for the Granularity UI => compute it based on STEPS and MAX_HISTOGRAM_BARS configured
    • Add range/intervals validation logic
    • Add Tooltips to the range forms panel
    • Revisit the Granularity UI
    • Revisit the Auto interval UI
    • Fix the Drag and Drop re-order issue in Advanced Editor
  • Missing features

Related issue #59424

Checklist

Delete any items that are not applicable to this PR.

@dej611 dej611 added release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 Feature:Lens v7.10.0 labels Aug 27, 2020
@cchaos cchaos self-requested a review September 4, 2020 19:11
@dej611
Copy link
Contributor Author

dej611 commented Sep 7, 2020

@cchaos @AlonaNadler The PR is in good shape to be reviewed now.

The panel does not show the Max Intervals (bars) anymore now, as after a discussion with @flash1293, I decided to stop at the development for a good MVP first, instead of an all-in-one solution.

I think that probably the Max Intervals (bars) feature may require some additional discussion about what the user may expect from it, and how to retrieve all the data in order to make that happen, which should be held in a future enhancement step. I preferred to give priority to the base functionality as for now in this PR: let me know what you think.

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

Most of this review is based on the idea that there should be consistency between how we expose these options in Visualize and Lens, not because we can't do something different, but because I don't think these differences are intentional.

@dej611
Copy link
Contributor Author

dej611 commented Sep 18, 2020

@wylieconlon @AlonaNadler @cchaos the PR is up-to-date with the latest design anche changes requested.
Please let me know your feedback about this state.

@dej611
Copy link
Contributor Author

dej611 commented Sep 21, 2020

@elasticmachine merge upstream

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

I remember we talked about fixing the "Over time" case to always put the date on the x axis if it's present, but this doesn't seem to be in the latest version:
Screenshot 2020-09-21 at 12 05 24

Could you check what happened there?

Otherwise this looks good to me

src/plugins/data/common/search/aggs/buckets/range.ts Outdated Show resolved Hide resolved
@dej611
Copy link
Contributor Author

dej611 commented Sep 21, 2020

@flash1293 I think this reverted it to handle in a different way: 41a937c (#76121)

It broke the original behaviour but perhaps there's a way to have the same result at higher level?

@flash1293
Copy link
Contributor

@dej611 We can sort that out separately, thanks for linking to the change

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

Very nice work! I think we can merge this and make some behavioral tweaks later.

export const DEFAULT_INTERVAL = 1000;
export const AUTO_BARS = 'auto';
export const MIN_HISTOGRAM_BARS = 1;
export const SLICES = 6;
Copy link
Contributor

Choose a reason for hiding this comment

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

My opinion on the granularity settings has changed a bit since we last talked about it. The main reason is that with these settings, there is a big jump from 1 bar to 10-16 bars, which prevents me from getting anything in between. I'm not sure what the right tweak is, but if I could hardcode my "optimal" steps it might be something like [1, 5, 10, 20, 40, 80, 100, 200].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have some concerns about an hardcoded set of values:

  1. we might have to think about a strategy in case the user specify a maxHistogramBars value which is not covered in the list
  2. because the range input starts with the middle mark, the list might have an odd number of values

Because of 1) I feel we may fall again under a slices approach - maybe it's a rare scenario ok -, while for 2) it's more a stylistic reason.

@AlonaNadler
Copy link

Great work @dej611 👍 👏
The PR looks great, big improvement.

  • the auto ranges works great. The manual custom intervals work fantastic.
    Few minor things:
  • Sometimes when I click on the + nothing happens. But once I clicked on the + multiple times the granularity changes. Ideally every click on + or - changes the preview. example:

Sep-22-2020 07-00-52

  • We need a text review doc.

@dej611
Copy link
Contributor Author

dej611 commented Sep 22, 2020

Sometimes when I click on the + nothing happens. But once I clicked on the + multiple times the granularity changes. Ideally every click on + or - changes the preview. example:

@AlonaNadler I see.
That is relative to the number of slices set right now compared to the dataset whole range. Even if the numbers of slices goes from 7 to 5 it will still happen based on the dataset size for smaller ones.

@flash1293
Copy link
Contributor

Sometimes when I click on the + nothing happens. But once I clicked on the + multiple times the granularity changes. Ideally every click on + or - changes the preview. example:

This is a limitation we can't work around right now because of the reasons discussed in the last weekly (we don't know the actual data distribution in the config UI). I think the current UI does a good job at working with this limitation but it's not perfect. Once we expose the currently rendered data we can think about how to improve this experience.

@dej611 dej611 requested a review from cchaos September 22, 2020 15:48
Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

@dej611 I pushed a design cleanup commit essentially adding some tooltips to the buttons and fixing accessibility and layouts. LGTM from my side. It would be nice if we could eventually add a tooltip generally to the "Granularity" label explaining the concept, but I won't hold up this PR anymore.

@dej611 dej611 self-assigned this Sep 23, 2020
@dej611 dej611 merged commit 0f8043c into elastic:master Sep 23, 2020
@dej611 dej611 deleted the feature/lens/histograms branch September 23, 2020 08:23
@dej611 dej611 linked an issue Sep 23, 2020 that may be closed by this pull request
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
lens 461 +14 447

page load bundle size

id value diff baseline
lens 1.1MB +30.2KB 1.1MB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

gmmorris added a commit to gmmorris/kibana that referenced this pull request Sep 23, 2020
* master: (31 commits)
  skip tests for old pacakge (elastic#78194)
  [Ingest Pipelines] Add url generator for ingest pipelines app (elastic#77872)
  [Lens] Rename "telemetry" to "stats" (elastic#78125)
  [CSM] Url search (elastic#77516)
  [Drilldowns] Config to disable URL Drilldown  (elastic#77887)
  [Lens] Combined histogram/range aggregation for numbers (elastic#76121)
  Remove legacy plugins support (elastic#77599)
  'Auto' interval must be correctly calculated for natural numbers (elastic#77995)
  [CSM] fix ingest data retry order messed up (elastic#78163)
  Add response status helpers (elastic#78006)
  Bump react-beautiful-dnd (elastic#78028)
  [Security Solution][Detection Engine] Bubbles up more error messages from ES queries to the UI (elastic#78004)
  Index pattern  - refactor constructor (elastic#77791)
  Add `xpack.security.sameSiteCookies` to docker allow list (elastic#78192)
  Remove [key: string]: any; from IIndexPattern (elastic#77968)
  Remove requirement for manage_index_templates privilege for Index Management (elastic#77377)
  [Ingest Manager] Agent bulk actions UI (elastic#77690)
  [Metrics UI] Add inventory view timeline (elastic#77804)
  Reporting/Docs: Updates for setting to enable CSV Download (elastic#78101)
  Update to latest rum-react (elastic#78193)
  ...
dej611 added a commit to dej611/kibana that referenced this pull request Sep 23, 2020
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Marta Bondyra <marta.bondyra@elastic.co>
Co-authored-by: cchaos <caroline.horn@elastic.co>
dej611 added a commit that referenced this pull request Sep 23, 2020
#78287)

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Marta Bondyra <marta.bondyra@elastic.co>
Co-authored-by: cchaos <caroline.horn@elastic.co>

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Marta Bondyra <marta.bondyra@elastic.co>
Co-authored-by: cchaos <caroline.horn@elastic.co>
@dej611 dej611 mentioned this pull request Oct 22, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Create combined histogram/range aggregation for numbers
10 participants