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

[Discover] Fix broken setting of bucketInterval #62939

Conversation

kertal
Copy link
Member

@kertal kertal commented Apr 8, 2020

Summary

When a manual interval is chosen in Discover histogram which is too small for the current time range, it's scaled up, and the user gets notified by a text. This was broken, due to changes in the Visualizations API, and a watcher was never triggered because of this. This PR restores displaying this information.

78657686-6ebf1e80-78c9-11ea-96ca-933478b74907

Fixes #62753

How to test

  1. Go to discover
  2. Expand time range to multiple days
  3. Set histogram interval to milliseconds

Checklist

@kertal kertal self-assigned this Apr 8, 2020
@kertal kertal added the Feature:Discover Discover Application label Apr 8, 2020
@@ -675,17 +675,6 @@ function discoverController(
}
});

$scope.$watch('vis.aggs', function() {
Copy link
Member Author

@kertal kertal Apr 8, 2020

Choose a reason for hiding this comment

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

The watcher didn't work due to the Visualizations API changes, decided it's even not needed and removed it in favor of a simpler solution

@@ -891,6 +880,9 @@ function discoverController(
tabifiedData,
getDimensions($scope.vis.data.aggs.aggs, $scope.timeRange)
);
if ($scope.vis.data.aggs.aggs[1]) {
$scope.bucketInterval = $scope.vis.data.aggs.aggs[1].buckets.getInterval();
}
Copy link
Member Author

Choose a reason for hiding this comment

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

dear @ppisljar, this API changed. This works, but I wonder if there's a better way to do it. Before it was done this way:

      const buckets = $scope.vis.data.aggs.byTypeName('buckets');		

          if (buckets && buckets.length === 1) {		
           $scope.bucketInterval = buckets[0].buckets.getInterval();		
         }

@kertal
Copy link
Member Author

kertal commented Apr 8, 2020

@elasticmachine merge upstream

@@ -66,34 +66,34 @@ export default function({ getService, getPageObjects }) {
});

it('should visualize monthly data with different day intervals', async () => {
//Nov 1, 2017 @ 01:00:00.000 - Mar 21, 2018 @ 02:00:00.000
Copy link
Member Author

Choose a reason for hiding this comment

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

all the input time ranges in this tests where invalid, fixed that

@kertal kertal added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Apr 9, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@kertal kertal marked this pull request as ready for review April 9, 2020 18:33
@kertal kertal requested review from a team and flash1293 April 9, 2020 18:33
@kertal kertal added the release_note:skip Skip the PR/issue when compiling release notes label Apr 10, 2020
@kertal kertal requested a review from ppisljar April 10, 2020 08:03
@flash1293
Copy link
Contributor

@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.

Tested with time based and time less index pattern, works as expected in all scenarios. Thanks a lot for the functional test! I strongly prefer the new solution.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

kertal added a commit to kertal/kibana that referenced this pull request Apr 15, 2020
* Fix broken setting of bucketInterval, remove $watch

* Fix and adapt functional tests
kertal added a commit to kertal/kibana that referenced this pull request Apr 15, 2020
* Fix broken setting of bucketInterval, remove $watch

* Fix and adapt functional tests
gmmorris added a commit to gmmorris/kibana that referenced this pull request Apr 15, 2020
* master: (29 commits)
  Add test:jest_integration npm script (elastic#62938)
  [data.search.aggs] Remove service getters from agg types (AggConfig part) (elastic#62548)
  [Discover] Fix broken setting of bucketInterval (elastic#62939)
  Disable adding conditions when in alert management context. (elastic#63514)
  [Alerting] fixes to allow pre-configured actions to be executed (elastic#63432)
  adding useMemo (elastic#63504)
  [Maps] fix double fetch when filter pill is added (elastic#63024)
  [Lens] Fix missing formatting bug in "break down by" (elastic#63288)
  [SIEM] [Cases] Removed double pasted line (elastic#63507)
  [Reporting] Improve functional test steps (elastic#63259)
  [SIEM][CASE] Tests for server's configuration API (elastic#63099)
  [SIEM] [Cases] Case container unit tests (elastic#63376)
  [ML] Improving parsing of large uploaded files (elastic#62970)
  [ML] Listing global calendars on the job management page (elastic#63124)
  [Ingest][Endpoint] Add Ingest rest api response types for use in Endpoint (elastic#63373)
  Add help text to form fields (elastic#63165)
  [ML] Converts utils Mocha tests to Jest (elastic#63132)
  [Metrics UI] Refactor With* containers to hooks (elastic#59503)
  [NP] Migrate logstash server side code to NP (elastic#63135)
  Clicking cancel in saved query save modal doesn't close it (elastic#62774)
  ...
kertal added a commit that referenced this pull request Apr 15, 2020
* Fix broken setting of bucketInterval, remove $watch

* Fix and adapt functional tests
kertal added a commit that referenced this pull request Apr 15, 2020
* Fix broken setting of bucketInterval, remove $watch

* Fix and adapt functional tests
wayneseymour pushed a commit that referenced this pull request Apr 15, 2020
* Fix broken setting of bucketInterval, remove $watch

* Fix and adapt functional tests
tsullivan pushed a commit to tsullivan/kibana that referenced this pull request Apr 15, 2020
…tic#63546)

* Fix broken setting of bucketInterval, remove $watch

* Fix and adapt functional tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto scaling interval not shown in Discover
4 participants