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

Fix visualizations for rollups using fixed_interval or calendar_interval #39537

Merged
merged 4 commits into from
Jun 28, 2019

Conversation

wylieconlon
Copy link
Contributor

@wylieconlon wylieconlon commented Jun 24, 2019

Summary

Visualizations on rollup index patterns were failing due to improper use of the interval value. Fixes #36295

Steps to reproduce the bug:

  1. Create a rollup with a time interval such as 5m or 24h. These kinds of rollups are stored as fixed_interval in the index pattern.
  2. Create another rollup with a time interval such as 1h. This is stored as a calendar_interval in the index pattern.
  3. Wait for the rollup data to come in
  4. Go to visualize and create a Date Histogram aggregation for the new rollup index pattern, for both.
  5. You should be able to select any interval that is a multiple of the rollup interval. For a fixed interval like 5m, it will multiply to 10m, 15m, etc. For a calendar interval like 1h, it will multiply to 1d, 1M, etc.

Screenshot 2019-06-24 16 48 21

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@wylieconlon wylieconlon added Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Vis Editor Visualization editor issues v8.0.0 Feature:Rollups v7.3.0 labels Jun 24, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@cjcenizal cjcenizal removed their request for review June 24, 2019 20:56
@wylieconlon wylieconlon requested a review from timroes June 24, 2019 20:59
@@ -56,7 +56,7 @@ export function initEditorConfig() {

// Set date histogram time zone based on rollup capabilities
if (aggTypeName === 'date_histogram') {
const interval = fieldAgg.interval;
const interval = fieldAgg.fixed_interval ? fieldAgg.fixed_interval : fieldAgg.interval;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this actually use the logic fixed_interval || calendar_interval || interval? #36306

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it should...

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@wylieconlon
Copy link
Contributor Author

@timroes I'd appreciate any suggestion on who to reach out to for review

@wylieconlon
Copy link
Contributor Author

Need to update this because rollups are also using calendar_interval #36310

@wylieconlon wylieconlon changed the title Fix visualizations for rollups using fixed_interval Fix visualizations for rollups using fixed_interval or calendar_interval Jun 26, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

Code LGTM! I tested locally to make sure that both calendar and fixed rollup indices allow the correct interval inputs, their requests are sent correctly with either calendar_interval or fixed_interval, and that their visualizations render.

@timroes
Copy link
Contributor

timroes commented Jun 27, 2019

@jen-huang out of curiosity and so we can track this: Since 7.3 rollup jobs created by Kibana will have a calendar_interval and fixed_interval instead of an interval? But jobs created beforehand, or even if creating a job manually until 8.0 it could still use interval? With 8.0, will that be removed, will it only be removed to create new jobs with interval or can we be sure no job has interval in it anymore?

cc @alexwizp

@timroes timroes closed this Jun 27, 2019
@timroes timroes reopened this Jun 27, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@jen-huang
Copy link
Contributor

@timroes I checked with Zack (@polyfractal) and he will look into whether we will leave interval deprecated for longer than 8.0 (which was the original goal). He will leave a reply after investigating.

@polyfractal
Copy link
Contributor

If you don't need an answer immediately, I'm going to bring this up at the weekly meeting and collect some feedback. The original plan was indeed 8.0... but considering the scope of the change (everyone who uses a date_histo, kibana or otherwise) it might be worth leaving this deprecated for a long time.

That said, we can probably "upgrade" rollup configs to fixed/calendar automatically. Internally it already upgrades to the correct type when it encounters a legacy interval, so we could easily just persist that (either when the job starts, or perhaps as an upgrade migration helper) So even if the date histo has a long deprecation period, we can probably simplify rollup since we are in full control.

@wylieconlon
Copy link
Contributor Author

@polyfractal @jen-huang Based on that feedback, it seems like the rollup jobs could still contain interval until we do the automatic migration you mentioned. Assuming I'm reading that correctly I'd like to get this merged and backported for 7.3 with fallback to interval, but please let me know if I should make a change.

@timroes
Copy link
Contributor

timroes commented Jun 28, 2019

@wylieconlon I don't think there are any changes needed given that information. so feel free to merge it.

@polyfractal
Copy link
Contributor

it seems like the rollup jobs could still contain interval until we do the automatic migration you mentioned

Yeah that's correct, jobs that were created pre-7.2 will still have interval in their config (both in the cluster state used by the running job, and in the _meta stored with the data)

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@wylieconlon
Copy link
Contributor Author

Jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@wylieconlon
Copy link
Contributor Author

Jenkins, test this. More flakiness

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@wylieconlon wylieconlon merged commit ad04e54 into elastic:master Jun 28, 2019
@wylieconlon wylieconlon deleted the fix-rollups-fixed-interval branch June 28, 2019 19:48
wylieconlon pushed a commit to wylieconlon/kibana that referenced this pull request Jun 28, 2019
…val (elastic#39537)

* Fix visualizations for rollups using fixed_interval

* Update to support calendar_interval as well
wylieconlon pushed a commit to wylieconlon/kibana that referenced this pull request Jun 28, 2019
…val (elastic#39537)

* Fix visualizations for rollups using fixed_interval

* Update to support calendar_interval as well
wylieconlon pushed a commit that referenced this pull request Jun 28, 2019
…val (#39537) (#39941)

* Fix visualizations for rollups using fixed_interval

* Update to support calendar_interval as well
wylieconlon pushed a commit that referenced this pull request Jun 28, 2019
…val (#39537) (#39942)

* Fix visualizations for rollups using fixed_interval

* Update to support calendar_interval as well
@timroes timroes added the v7.2.1 label Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Rollups Feature:Vis Editor Visualization editor issues Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.2.1 v7.3.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visualize date histogram incorrectly set for Rollup-based visualization, causing it to fail
5 participants