Skip to content

Adds abortable timeout counter to notifications#6364

Merged
rashidkpc merged 1 commit intoelastic:masterfrom
tylersmalley:5079-error-timeout
Mar 23, 2016
Merged

Adds abortable timeout counter to notifications#6364
rashidkpc merged 1 commit intoelastic:masterfrom
tylersmalley:5079-error-timeout

Conversation

@tylersmalley
Copy link
Copy Markdown
Member

Adds abortable timeout counter to notifications

This prevents errors from stacking up for long running dashboards.

  • Clicking "Auto-closing in X" dismisses timer
  • Clicking "More Info" dismisses timer
  • Timer is reset when a stack is added to the notification

kibana-6364

@tylersmalley tylersmalley force-pushed the 5079-error-timeout branch 3 times, most recently from 608099c to 7b7c4f9 Compare March 1, 2016 01:54
@tylersmalley tylersmalley changed the title Sets timeout for errors to 5 minutes Adds abortable timeout counter to notifications Mar 1, 2016
@epixa
Copy link
Copy Markdown
Contributor

epixa commented Mar 1, 2016

Looks like one test failed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ideally this would be configurable, try searching the repo for "courier:maxSegmentCount" to see how it is implemented.

@tylersmalley
Copy link
Copy Markdown
Member Author

@epixa and @spalger - addressed your comments. I added a config to Notifier and put the lifetimes and intervals on it. Let me know your thoughts.

@epixa
Copy link
Copy Markdown
Contributor

epixa commented Mar 1, 2016

@tylersmalley In this situation, toss the review label on it and assign it back to whichever reviewer feels most appropriate. I'll take it for tomorrow, but it'll need two reviews anyway, so @spalger can take another look when he gets a chance.

@epixa epixa added the review label Mar 1, 2016
@epixa epixa assigned epixa and unassigned tylersmalley Mar 1, 2016
@epixa epixa added the v5.0.0 label Mar 1, 2016
@epixa
Copy link
Copy Markdown
Contributor

epixa commented Mar 2, 2016

This doesn't seem to respect the errorLifetime setting. I changed mine to 5 seconds, but the auto-close still counts down from 300 seconds. I thought it may have been a caching bug, but it doesn't work even after a full page refresh.

@epixa epixa added needs updates and removed review labels Mar 2, 2016
@epixa epixa assigned tylersmalley and unassigned epixa Mar 2, 2016
@tylersmalley
Copy link
Copy Markdown
Member Author

@epixa it appears Notifier is bootstrapped before the config is initialized. I was testing by changing defaults, so this got by me.

Is this a logical change to https://github.com/elastic/kibana/pull/6364/files#diff-8441652c6398f70b4afcb491325bc8e9R20?

module.run(function ($rootScope, $interval, config) {
  Notifier.applyConfig({
    setInterval: $interval,
    clearInterval: $interval.cancel
  });

  $rootScope.$on('init:config', function () {
    // provide alternate methods for setting intervals
    // which will properly trigger digest cycles
    Notifier.applyConfig({
      errorLifetime: config.get('notifications:errorLifetime')
    });
  });
});

Also, should we also add warningLifetime and infoLifetime to the advanced configuration?

@epixa
Copy link
Copy Markdown
Contributor

epixa commented Mar 2, 2016

config.init() is idempotent and returns a promise for when the config is bootstrapped. I'd recommend using that rather than binding to an event on scope.

It'd probably be best to keep the implementation as simple as possible at first. What do you think about changing the config property to notifications:lifetime and applying it to all notification types? If it becomes apparent that individual lifetime values are useful in practice, then we can always expand upon the implementation with type-based lifetimes.

@tylersmalley tylersmalley force-pushed the 5079-error-timeout branch 5 times, most recently from d4e98b9 to 73d40ec Compare March 8, 2016 21:59
@tylersmalley tylersmalley force-pushed the 5079-error-timeout branch 3 times, most recently from f482501 to 8f90829 Compare March 22, 2016 21:15
@tylersmalley
Copy link
Copy Markdown
Member Author

@epixa, I have updated the PR per our conversation. 'change:config' is only called on subsequent updates after the initialization, so we have to use two listeners the but we remove the 'init:config' listener after it has been called.

This prevents errors from stacking up for long running dashboards.

* Clicking "Auto-closing in X" dismisses timer
* Clicking "More Info" dismisses timer
* Timer is reset when a stack is added to the notification

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@epixa
Copy link
Copy Markdown
Contributor

epixa commented Mar 23, 2016

LGTM

@epixa epixa assigned tylersmalley and unassigned epixa Mar 23, 2016
@rashidkpc
Copy link
Copy Markdown
Contributor

@tylersmalley I'm merging this and handing you another pull to make a small change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants