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

add autoRefreshFetch event to timefilter #20863

Merged
merged 6 commits into from
Jul 24, 2018

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Jul 16, 2018

short term fix for #20813

SearchPoll emits the timefilter event autoRefreshFetch when the auto refresh interval is reached. Visualizations subscribe to this event and fetch data.

cc @timroes @stacey-gammon @markov00 @cjcenizal

@nreese nreese added the WIP Work in progress label Jul 16, 2018
@@ -71,6 +72,7 @@ export class EmbeddedVisualizeHandler {
this._vis.on('update', this._handleVisUpdate);
this._vis.on('reload', this._reloadVis);
this._uiState.on('change', this._fetchAndRender);
timefilter.on('autoRefreshFetch', this._fetchAndRender);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% sure what the forceFetch parameter does, but I think it means it won't refetch data unless the vis params has changed so we probably want to use this._reloadVis as the listener here, just like we do for the reload event on this._vis.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I would agree with Spencer here. forceFetch will actually be passed to the request handler, and it should use it to ignore every possible caching it has. In case of the courier request handler, that means, it won't check if any configuration/timeRange, etc actually changed, and instead always query again. So we will need this for auto refresh, since in case of auto refresh no configuration change, so please replace that by calling this._reloadVis.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@@ -71,6 +72,7 @@ export class EmbeddedVisualizeHandler {
this._vis.on('update', this._handleVisUpdate);
this._vis.on('reload', this._reloadVis);
this._uiState.on('change', this._fetchAndRender);
timefilter.on('autoRefreshFetch', this._fetchAndRender);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I would agree with Spencer here. forceFetch will actually be passed to the request handler, and it should use it to ignore every possible caching it has. In case of the courier request handler, that means, it won't check if any configuration/timeRange, etc actually changed, and instead always query again. So we will need this for auto refresh, since in case of auto refresh no configuration change, so please replace that by calling this._reloadVis.

@@ -270,6 +270,7 @@ function VisEditor(

timefilter.enableAutoRefreshSelector();
$scope.$listenAndDigestAsync(timefilter, 'timeUpdate', updateTimeRange);
$scope.$listenAndDigestAsync(timefilter, 'autoRefreshFetch', updateTimeRange);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we won't need that. Since another auto refresh trigger, will never cause the time to actually change, since timefilter.getTime() will return the still stringified from/to, like "now-7d". Have you experienced any issues without that listener?

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@nreese
Copy link
Contributor Author

nreese commented Jul 24, 2018

jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@timroes timroes requested a review from ppisljar July 24, 2018 07:18
@timroes
Copy link
Contributor

timroes commented Jul 24, 2018

Jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@timroes
Copy link
Contributor

timroes commented Jul 24, 2018

Jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

this adds the concept of visualize reaching out to some global context and knowing about implementation details of other systems in order to work correctly.

this is something we were trying to remove (and of course broke auto refresh in the process 🥇 )

i would suggest we keep to the idea of visualize having no idea about the outside world and move the responsibility of handling autorefresh to the embedding app.

@timroes what do you think ?

@timroes
Copy link
Contributor

timroes commented Jul 24, 2018

@ppisljar I think the proper long term solution is to build an own service for auto refresh as Nathan discussed with Spencer (see #20813 (comment)). Though I think for a short term solution (since this will block 6.4) release and that auto refresh service should be properly design, this is a viable solution I would be willing to go with.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

LGTM as its a working solution and its a blocker and as we have a plan on how to improve it in the long run.

Copy link
Contributor

@timroes timroes 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 as a short term solution, but we'll still want to create a proper auto refresh service (@nreese could you perhaps open another ticket for that, so it won't be forgotten?).

Tested in Chrome Linux, auto refresh now works fine on dashboard and in visualize again.

@nreese nreese merged commit 6132cd9 into elastic:master Jul 24, 2018
nreese added a commit to nreese/kibana that referenced this pull request Jul 24, 2018
* add autoRefreshFetch event to timefilter

* replace fetchAndRender with reloadVis remove listener from editor

* unsubscribe correct handler
@nreese nreese mentioned this pull request Jul 24, 2018
@nreese
Copy link
Contributor Author

nreese commented Jul 24, 2018

but we'll still want to create a proper auto refresh service (@nreese could you perhaps open another ticket for that, so it won't be forgotten?).

Issue created - #21150. Please add to the ticket as needed

timroes pushed a commit that referenced this pull request Jul 24, 2018
* add autoRefreshFetch event to timefilter

* replace fetchAndRender with reloadVis remove listener from editor

* unsubscribe correct handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker v6.4.0 WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants