From aaa83c297b19de3d9cbb93a0e7569aa8693e6277 Mon Sep 17 00:00:00 2001 From: Khalah Jones-Golden Date: Mon, 4 Apr 2016 20:15:27 -0400 Subject: [PATCH 01/11] [CSS] Trying to fix charts, got dashboard good, but visualize is being stubbonr, suspect something to do with the visualize element not being native html --- src/plugins/kibana/public/dashboard/styles/main.less | 2 +- src/ui/public/chrome/directives/app_switcher/app_switcher.less | 1 + src/ui/public/styles/base.less | 1 + src/ui/public/visualize/visualize.less | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/kibana/public/dashboard/styles/main.less b/src/plugins/kibana/public/dashboard/styles/main.less index a0cccdd1e6ddc..c1bce6a3098e8 100644 --- a/src/plugins/kibana/public/dashboard/styles/main.less +++ b/src/plugins/kibana/public/dashboard/styles/main.less @@ -147,7 +147,7 @@ dashboard-grid { .panel-content { display: flex; flex: 1 1 100%; - height: auto; + height: 100%; } } } diff --git a/src/ui/public/chrome/directives/app_switcher/app_switcher.less b/src/ui/public/chrome/directives/app_switcher/app_switcher.less index 6965353d0085b..ba3fe42f3c56b 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.less +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.less @@ -57,6 +57,7 @@ body { overflow-x: hidden; } &.hidden-chrome { left: 0; } &-panel { .flex-parent(@shrink: 0); + height: 100%; box-shadow: -4px 0px 3px rgba(0,0,0,0.2); } diff --git a/src/ui/public/styles/base.less b/src/ui/public/styles/base.less index 1933d84384ef6..a217d41d62b74 100644 --- a/src/ui/public/styles/base.less +++ b/src/ui/public/styles/base.less @@ -94,6 +94,7 @@ ul.navbar-inline li { .flex-parent(@shrink: 0); position: relative; z-index: 0; + max-height: 100%; background-color: @white; } diff --git a/src/ui/public/visualize/visualize.less b/src/ui/public/visualize/visualize.less index e1e7805e3d08c..9a0d7173c17b5 100644 --- a/src/ui/public/visualize/visualize.less +++ b/src/ui/public/visualize/visualize.less @@ -20,6 +20,7 @@ visualize { overflow: auto; -webkit-transition: opacity 0.01s; transition: opacity 0.01s; + max-height: 100%; &.spy-only { display: none; From 952b17c824acbf9b49e785c7b00e786b247385b9 Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 20 Apr 2016 19:40:46 -0500 Subject: [PATCH 02/11] [kbnTopNav] insert DOM content before compiling --- src/ui/public/kbn_top_nav/kbn_top_nav_controller.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js index 34e2d61fa128c..b74917fb68e7e 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js @@ -87,8 +87,9 @@ export default function ($compile) { } const $childScope = $scope.$new(); - const $el = $compile(templateToRender)($childScope); - $element.find('#template_wrapper').html($el); + const $el = $element.find('#template_wrapper').html(templateToRender).contents(); + $compile($el)($childScope); + this.rendered = { $childScope, $el, key: currentKey }; } }; From ae6aaa3e8645c2636bea80f261052e9b8a45eb02 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 25 Apr 2016 11:44:10 -0500 Subject: [PATCH 03/11] Minimal changes to support Shield Login. --- test/support/pages/common.js | 18 ++++++++++++++++ test/support/pages/shield_page.js | 35 +++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 test/support/pages/shield_page.js diff --git a/test/support/pages/common.js b/test/support/pages/common.js index bb8faaa970887..dca9a6c1caf10 100644 --- a/test/support/pages/common.js +++ b/test/support/pages/common.js @@ -10,6 +10,9 @@ define(function (require) { var parse = require('intern/dojo/node!url').parse; var format = require('intern/dojo/node!url').format; var path = require('intern/dojo/node!path'); + var ShieldPage = require('../../support/pages/shield_page'); + + var shieldPage; function injectTimestampQuery(func, url) { var formatted = modifyQueryString(url, function (parsed) { @@ -43,6 +46,7 @@ define(function (require) { remote.get.wrapper = injectTimestampQuery; this.remote.getCurrentUrl = _.wrap(this.remote.getCurrentUrl, removeTimestampQuery); } + shieldPage = new ShieldPage(this.remote); } @@ -90,6 +94,20 @@ define(function (require) { .then(function () { return self.remote.getCurrentUrl(); }) + .then(function (currentUrl) { + var loginPage = new RegExp('login').test(currentUrl); + if (loginPage) { + self.debug('Found loginPage = ' + loginPage + ', username = ' + + config.servers.kibana.shield.username); + return shieldPage.login(config.servers.kibana.shield.username, + config.servers.kibana.shield.password) + .then(function () { + return self.remote.getCurrentUrl(); + }); + } else { + return currentUrl; + } + }) .then(function (currentUrl) { currentUrl = currentUrl.replace(/\/\/\w+:\w+@/, '//'); var navSuccessful = new RegExp(appUrl).test(currentUrl); diff --git a/test/support/pages/shield_page.js b/test/support/pages/shield_page.js new file mode 100644 index 0000000000000..6f14d5ad425d3 --- /dev/null +++ b/test/support/pages/shield_page.js @@ -0,0 +1,35 @@ +// in test/support/pages/shield_page.js +define(function (require) { + var config = require('intern').config; + var defaultTimeout = config.timeouts.default; + + // the page object is created as a constructor + // so we can provide the remote Command object + // at runtime + function ShieldPage(remote) { + this.remote = remote; + } + + ShieldPage.prototype = { + constructor: ShieldPage, + + login: function login(user, pwd) { + var self = this.remote; + return self.setFindTimeout(5000) + .findById('username') + .type(user) + .then(function () { + return self.findById('password') + .type(pwd); + }) + .then(function () { + return self.findByCssSelector('.btn') + .click(); + }); + } + + + }; + + return ShieldPage; +}); From 14be3691f50d0fcd0988cac0d192e60467955ecb Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 25 Apr 2016 12:00:16 -0500 Subject: [PATCH 04/11] Change to doNavigation(appUrl). --- test/support/pages/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/pages/common.js b/test/support/pages/common.js index dca9a6c1caf10..bc3c891e1ab1f 100644 --- a/test/support/pages/common.js +++ b/test/support/pages/common.js @@ -125,7 +125,7 @@ define(function (require) { }); }; - return doNavigation(navUrl) + return doNavigation(appUrl) .then(function (currentUrl) { var lastUrl = currentUrl; return self.tryForTime(defaultTimeout, function () { From fbb3e2011bd978f409bd606dd4a8a54bba61ceeb Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 25 Apr 2016 12:40:35 -0500 Subject: [PATCH 05/11] Revert back to doNavigation(navUrl). --- test/support/pages/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/pages/common.js b/test/support/pages/common.js index bc3c891e1ab1f..dca9a6c1caf10 100644 --- a/test/support/pages/common.js +++ b/test/support/pages/common.js @@ -125,7 +125,7 @@ define(function (require) { }); }; - return doNavigation(appUrl) + return doNavigation(navUrl) .then(function (currentUrl) { var lastUrl = currentUrl; return self.tryForTime(defaultTimeout, function () { From 3acb57fd804ba6c87eae8e1bb2ae088b3d34c842 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 25 Apr 2016 16:48:25 -0500 Subject: [PATCH 06/11] [browser tests] allow multiple plugins to be specified in test bundle --- src/plugins/tests_bundle/index.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/plugins/tests_bundle/index.js b/src/plugins/tests_bundle/index.js index eb3bd122092c8..806b16761d0bc 100644 --- a/src/plugins/tests_bundle/index.js +++ b/src/plugins/tests_bundle/index.js @@ -19,21 +19,21 @@ export default (kibana) => { let config = kibana.config; const testGlobs = ['src/ui/public/**/*.js']; - const testingPluginId = config.get('tests_bundle.pluginId'); + const testingPluginIds = config.get('tests_bundle.pluginId'); - if (testingPluginId) { - const plugin = plugins.byId[testingPluginId]; - if (!plugin) throw new Error('Invalid testingPluginId :: unknown plugin ' + testingPluginId); + if (testingPluginIds) { + testGlobs.push('!src/ui/public/**/__tests__/**/*'); + testingPluginIds.split(',').forEach((pluginId) => { + const plugin = plugins.byId[pluginId]; + if (!plugin) throw new Error('Invalid testingPluginId :: unknown plugin ' + pluginId); - // add the modules from all of this plugins apps - for (let app of plugin.apps) { - modules = union(modules, app.getModules()); - } + // add the modules from all of this plugins apps + for (let app of plugin.apps) { + modules = union(modules, app.getModules()); + } - testGlobs.push( - '!src/ui/public/**/__tests__/**/*', - `${plugin.publicDir}/**/__tests__/**/*.js` - ); + testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); + }); } else { // add the modules from all of the apps From 0865c55e7d0258f139329470481477ab83bfa3d3 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Fri, 8 Apr 2016 10:09:20 -0700 Subject: [PATCH 07/11] Limits memory usage V8 will not trigger a full mark-sweep & mark-compact until there is memory pressure for the max-old-space-size, which is 1.6GB on a 64bit system. This means that Kibana will, at times, consume over 1.6GB of RSS memory. Bypassing this can be done by starting with `--dev` or explicitally setting `max-old-space-size`. For example: `NODE_OPTIONS="--max-old-space-size=1024" ./bin/kibana` Signed-off-by: Tyler Smalley --- bin/kibana | 5 +++++ bin/kibana.bat | 4 +++- tasks/config/run.js | 19 ++++++++++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/bin/kibana b/bin/kibana index 1606ad2813025..bacfc0c8a986f 100755 --- a/bin/kibana +++ b/bin/kibana @@ -21,4 +21,9 @@ if [ ! -x "$NODE" ]; then exit 1 fi +# sets V8 defaults while still allowing them to be overridden +if echo "${@}" | grep -qv "\-\-dev"; then + NODE_OPTIONS="--max-old-space-size=256 $NODE_OPTIONS" +fi + exec "${NODE}" $NODE_OPTIONS "${DIR}/src/cli" ${@} diff --git a/bin/kibana.bat b/bin/kibana.bat index 2c39d080bf0ad..145a7e08a78c1 100644 --- a/bin/kibana.bat +++ b/bin/kibana.bat @@ -21,8 +21,10 @@ If Not Exist "%NODE%" ( ) ) +echo.%* | findstr /V /C:"--dev" && set NODE_OPTIONS=--max-old-space-size=256 %NODE_OPTIONS% + TITLE Kibana Server -"%NODE%" %NODE_OPTIONS% "%DIR%\src\cli" %* +call "%NODE%" %NODE_OPTIONS% "%DIR%\src\cli" %* :finally diff --git a/tasks/config/run.js b/tasks/config/run.js index e98bfe894e725..db0ee386595b3 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -25,13 +25,18 @@ module.exports = function (grunt) { return flags; }, []); + const devEnv = Object.assign(process.env, { + NODE_OPTIONS: '--max-old-space-size=1024' + }); + return { testServer: { options: { wait: false, ready: /Server running/, quiet: false, - failOnError: false + failOnError: false, + env: devEnv }, cmd: binScript, args: [ @@ -46,7 +51,8 @@ module.exports = function (grunt) { wait: false, ready: /Server running/, quiet: false, - failOnError: false + failOnError: false, + env: devEnv }, cmd: binScript, args: [ @@ -64,7 +70,8 @@ module.exports = function (grunt) { wait: false, ready: /Server running/, quiet: false, - failOnError: false + failOnError: false, + env: devEnv }, cmd: binScript, args: [ @@ -80,7 +87,8 @@ module.exports = function (grunt) { wait: false, ready: /Server running/, quiet: false, - failOnError: false + failOnError: false, + env: devEnv }, cmd: binScript, args: [ @@ -148,7 +156,8 @@ module.exports = function (grunt) { options: { wait: false, ready: /Optimization .+ complete/, - quiet: true + quiet: false, + env: devEnv }, cmd: './build/kibana/bin/kibana', args: [ From e8e9f589a26b0e3a1d5770d878d0fb71812cbea2 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Fri, 8 Apr 2016 10:12:08 -0700 Subject: [PATCH 08/11] Adds documentation for memory requirements Signed-off-by: Tyler Smalley --- README.md | 2 +- docs/production.asciidoc | 8 ++++++++ docs/setup.asciidoc | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a6fd89da74c2..593477e7f1ea1 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Kibana is an open source ([Apache Licensed](https://github.com/elastic/kibana/bl - Elasticsearch master - Kibana binary package +- 512 MB of available RAM ## Installation @@ -14,7 +15,6 @@ Kibana is an open source ([Apache Licensed](https://github.com/elastic/kibana/bl * Run `bin/kibana` on unix, or `bin\kibana.bat` on Windows. * Visit [http://localhost:5601](http://localhost:5601) - ## Upgrade from previous version * Move any custom configurations in your old kibana.yml to your new one diff --git a/docs/production.asciidoc b/docs/production.asciidoc index f911770e236c6..bf238d6147925 100644 --- a/docs/production.asciidoc +++ b/docs/production.asciidoc @@ -4,6 +4,7 @@ * <> * <> * <> +* <> How you deploy Kibana largely depends on your use case. If you are the only user, you can run Kibana on your local machine and configure it to point to whatever @@ -132,3 +133,10 @@ cluster.name: "my_cluster" # The Elasticsearch instance to use for all your queries. elasticsearch_url: "http://localhost:9200" -------- + +[float] +[[memory-management]] + +=== Memory management + +Kibana is built on Node.js which doesn't tune its heap size based on the amount of memory available. To combat this, we set defaults based on the requirements of Kibana needs, while allowing overhead for additional plugins. These defaults can be overridden at runtime, for example `NODE_OPTIONS="--max-old-space-size=512" bin/kibana`. diff --git a/docs/setup.asciidoc b/docs/setup.asciidoc index 74b87345bfb21..7ecc11f3f41c3 100644 --- a/docs/setup.asciidoc +++ b/docs/setup.asciidoc @@ -5,6 +5,7 @@ All you need is: * Elasticsearch {esversion} * A modern web browser - http://www.elastic.co/subscriptions/matrix#matrix_browsers[Supported Browsers]. +* 512 MB of available RAM * Information about your Elasticsearch installation: ** URL of the Elasticsearch instance you want to connect to. ** Which Elasticsearch indices you want to search. From d97b4bc3eb2f1e483e8b7191fc59b4d9c88cc208 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Wed, 27 Apr 2016 09:27:28 -0500 Subject: [PATCH 09/11] Fix setFindTimeout defaults to 10 seconds. --- test/intern.js | 4 ++-- test/support/pages/common.js | 2 +- test/support/pages/discover_page.js | 2 +- test/support/pages/header_page.js | 2 +- test/support/pages/settings_page.js | 5 +++-- test/support/pages/visualize_page.js | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/test/intern.js b/test/intern.js index 2ee453d0c0ac2..0a98f2134aed4 100644 --- a/test/intern.js +++ b/test/intern.js @@ -27,8 +27,8 @@ define(function (require) { } }, timeouts: { - // this is how long a test can run before timing out - default: 90000 + default: 90000, // this is how long a test can run before timing out + findTimeout: 10000 // this is how long we try to find elements on page }, }, serverConfig); }); diff --git a/test/support/pages/common.js b/test/support/pages/common.js index afb4995c6712b..f80b3fb4b8922 100644 --- a/test/support/pages/common.js +++ b/test/support/pages/common.js @@ -46,7 +46,7 @@ define(function (require) { } - var defaultTimeout = config.timeouts.default; + var defaultTimeout = config.timeouts.findTimeout; Common.prototype = { constructor: Common, diff --git a/test/support/pages/discover_page.js b/test/support/pages/discover_page.js index ced12f51efb75..da5a440f03fa4 100644 --- a/test/support/pages/discover_page.js +++ b/test/support/pages/discover_page.js @@ -3,7 +3,7 @@ define(function (require) { var config = require('intern').config; var Common = require('./common'); - var defaultTimeout = config.timeouts.default; + var defaultTimeout = config.timeouts.findTimeout; var common; var thisTime; diff --git a/test/support/pages/header_page.js b/test/support/pages/header_page.js index db8b87312be25..684903b103cfd 100644 --- a/test/support/pages/header_page.js +++ b/test/support/pages/header_page.js @@ -13,7 +13,7 @@ define(function (require) { common = new Common(this.remote); } - var defaultTimeout = config.timeouts.default; + var defaultTimeout = config.timeouts.findTimeout; HeaderPage.prototype = { constructor: HeaderPage, diff --git a/test/support/pages/settings_page.js b/test/support/pages/settings_page.js index 878cf13eb237a..665d5342d2be0 100644 --- a/test/support/pages/settings_page.js +++ b/test/support/pages/settings_page.js @@ -4,7 +4,7 @@ define(function (require) { var Promise = require('bluebird'); var Common = require('./common'); - var defaultTimeout = config.timeouts.default; + var defaultTimeout = config.timeouts.findTimeout; var common; function settingsPage(remote) { @@ -40,7 +40,8 @@ define(function (require) { return common.sleep(1000); }) .then(function setAdvancedSettingsClickPropertyValue(selectList) { - return self.remote.findByCssSelector('option[label="' + propertyValue + '"]') + return self.remote.setFindTimeout(defaultTimeout) + .findByCssSelector('option[label="' + propertyValue + '"]') .click(); }) .then(function setAdvancedSettingsClickSaveButton() { diff --git a/test/support/pages/visualize_page.js b/test/support/pages/visualize_page.js index 02e969d6855e1..d7f52aa36225a 100644 --- a/test/support/pages/visualize_page.js +++ b/test/support/pages/visualize_page.js @@ -4,7 +4,7 @@ define(function (require) { var registerSuite = require('intern!object'); var Common = require('./common'); - var defaultTimeout = config.timeouts.default; + var defaultTimeout = config.timeouts.findTimeout; var common; function VisualizePage(remote) { From 935fee7df1de9467ba773d085de3c0f81a5d1ee8 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Wed, 27 Apr 2016 15:21:39 -0500 Subject: [PATCH 10/11] Change 'self' to 'remote'. --- test/support/pages/shield_page.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/support/pages/shield_page.js b/test/support/pages/shield_page.js index 6f14d5ad425d3..0df4b5cddca4c 100644 --- a/test/support/pages/shield_page.js +++ b/test/support/pages/shield_page.js @@ -14,16 +14,16 @@ define(function (require) { constructor: ShieldPage, login: function login(user, pwd) { - var self = this.remote; - return self.setFindTimeout(5000) + var remote = this.remote; + return remote.setFindTimeout(5000) .findById('username') .type(user) .then(function () { - return self.findById('password') + return remote.findById('password') .type(pwd); }) .then(function () { - return self.findByCssSelector('.btn') + return remote.findByCssSelector('.btn') .click(); }); } From 99779653d757856c60bcedd914bb04e4423308d9 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Wed, 27 Apr 2016 17:45:24 -0500 Subject: [PATCH 11/11] Added change to shield_page after merge master. --- test/support/pages/shield_page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/support/pages/shield_page.js b/test/support/pages/shield_page.js index 0df4b5cddca4c..42b4800b74500 100644 --- a/test/support/pages/shield_page.js +++ b/test/support/pages/shield_page.js @@ -1,7 +1,7 @@ // in test/support/pages/shield_page.js define(function (require) { var config = require('intern').config; - var defaultTimeout = config.timeouts.default; + var defaultTimeout = config.timeouts.findTimeout; // the page object is created as a constructor // so we can provide the remote Command object @@ -15,7 +15,7 @@ define(function (require) { login: function login(user, pwd) { var remote = this.remote; - return remote.setFindTimeout(5000) + return remote.setFindTimeout(defaultTimeout) .findById('username') .type(user) .then(function () {