Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into granular-app-priv…
Browse files Browse the repository at this point in the history
…ileges
  • Loading branch information
kobelb committed Nov 27, 2018
2 parents 60a2e70 + 5ebca61 commit 8351171
Show file tree
Hide file tree
Showing 138 changed files with 2,566 additions and 501 deletions.
9 changes: 8 additions & 1 deletion .ci/packer_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
# run setup script that gives us node, yarn, and bootstraps the project
source "src/dev/ci_setup/setup.sh";

# cache es snapshots
# download es snapshots
node scripts/es snapshot --download-only;

# download reporting browsers
cd "x-pack";
yarn gulp prepare;
cd -;

# archive cacheable directories
mkdir -p "$HOME/.kibana/bootstrap_cache"
tar -cf "$HOME/.kibana/bootstrap_cache/master.tar" \
node_modules \
packages/*/node_modules \
x-pack/node_modules \
x-pack/plugins/*/node_modules \
x-pack/plugins/reporting/.chromium \
x-pack/plugins/reporting/.phantom \
.es;
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"paths": {
"common.ui": "src/ui",
"server": "src/server",
"console": "src/core_plugins/console",
"inputControl": "src/core_plugins/input_control_vis",
"kbn": "src/core_plugins/kibana",
Expand Down
11 changes: 4 additions & 7 deletions docs/monitoring/configuring-monitoring.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
<titleabbrev>Configuring monitoring</titleabbrev>
++++

If you enable the Elastic {monitor-features} in your cluster, you can
optionally collect metrics about {kib}:
If you enable the {monitor-features} in your cluster, there are two methods to
collect metrics about {kib}:

* <<monitoring-kibana>>
* <<monitoring-metricbeat>>


You can also use {kib} to visualize
monitoring data from across the {stack}:

* <<monitoring-data>>
You can also use {kib} to
<<monitoring-data,visualize monitoring data from across the {stack}>>.

To learn about monitoring in general, see
{stack-ov}/xpack-monitoring.html[Monitoring the {stack}].
Expand Down
7 changes: 4 additions & 3 deletions docs/monitoring/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ The {kib} {monitor-features} serve two separate purposes:

. To visualize monitoring data from across the {stack}. You can view health and
performance data for {es}, {ls}, and Beats in real time, as well as analyze past
performance. For more information, see
{stack-ov}/xpack-monitoring.html[Monitoring the {stack}].

performance.
. To monitor {kib} itself and route that data to the monitoring cluster.

If you enable monitoring across the {stack}, each {es} node, {ls} node, {kib}
Expand All @@ -22,6 +20,9 @@ or instance starts.
NOTE: Watcher must be enabled to view cluster alerts. If you have a Basic
license, Top Cluster Alerts are not displayed.

For more information, see <<configuring-monitoring>> and
{stack-ov}/xpack-monitoring.html[Monitoring the {stack}].

--

include::beats-details.asciidoc[]
Expand Down
26 changes: 25 additions & 1 deletion docs/monitoring/monitoring-troubleshooting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
++++

Use the information in this section to troubleshoot common problems and find
answers for frequently asked questions related to {monitoring}.
answers for frequently asked questions related to the {kib} {monitor-features}.

[float]
=== Cannot view the cluster because the license information is invalid
Expand All @@ -22,3 +22,27 @@ The following error appears in a banner at the top of the screen in {kib} on the
You cannot monitor a version 6.3 or later cluster from {kib} version 6.2 or earlier.
To resolve this issue, upgrade {kib} to 6.3 or later. See
{stack-ref}/upgrading-elastic-stack.html[Upgrading the {stack}].

[float]
=== No monitoring data is visible in {kib}

*Symptoms:*

The *Monitoring* page in {kib} is empty.

*Resolution:*

. Confirm that {kib} is seeking monitoring data from the appropriate {es} URL.
By default, data is retrieved from the cluster specified in the
`elasticsearch.url` setting in the `kibana.yml` file. If you want to retrieve it
from a different monitoring cluster, set `xpack.monitoring.elasticsearch.url`.
See <<monitoring-settings-kb>>.

. Confirm that there is monitoring data available at that URL. It is stored in
indices such as `.monitoring-kibana-*` and `.monitoring-es-*`. At a minimum, you
must have monitoring data for the {es} production cluster. Once that data exists,
{kib} can display monitoring data for other products in the cluster.

. Set the time filter to “Last 1 hour”. When monitoring data appears in your
cluster, the page automatically refreshes with the monitoring summary.

19 changes: 6 additions & 13 deletions docs/monitoring/viewing-metrics.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

After you collect monitoring data for one or more products in the {stack}, you
can configure {kib} to retrieve that information and display it in on the
*Monitoring* page.
*Monitoring* page.

At a minimum, you must have monitoring data for the {es} production cluster.
Once that data exists, {kib} can display monitoring data for other products in
the cluster.

. Identify where to retrieve monitoring data from.
+
Expand Down Expand Up @@ -91,15 +95,4 @@ Overview, Nodes, Indices, or Instances links. See <<xpack-monitoring>>.
[role="screenshot"]
image::images/monitoring-dashboard.png[Monitoring dashboard]

If {kib} can't activate monitoring, here are some things to do:

* If you don't have permission to activate monitoring,
contact your system administrator.

* If {kib} can't find monitoring data, set the time filter to
“Last 1 hour”. When monitoring data appears in your cluster, the page
automatically refreshes with the monitoring summary.

* Check your `xpack.monitoring.elasticsearch.url` setting.
See <<monitoring-settings-kb, Monitoring Settings in Kibana>>.

If you encounter problems, see <<monitor-troubleshooting,Troubleshooting monitoring>>.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
"bugs": {
"url": "http://github.com/elastic/kibana/issues"
},
"kibana": {
"clean": {
"extraPatterns": [
"build",
"optimize",
".eslintcache"
]
}
},
"author": "Rashid Khan <[email protected]>",
"scripts": {
"preinstall": "node ./preinstall_check",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/json5": "^0.0.30",
"@types/react-intl": "^2.3.11",
"cross-env": "^5.2.0",
"npm-run-all": "^4.1.3",
"npm-run-all": "^4.1.5",
"typescript": "^3.0.3"
},
"dependencies": {
Expand Down
48 changes: 34 additions & 14 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7845,7 +7845,6 @@ class Project {
this.path = projectPath;
this.packageJsonLocation = (0, _path.resolve)(this.path, 'package.json');
this.nodeModulesLocation = (0, _path.resolve)(this.path, 'node_modules');
this.optimizeLocation = (0, _path.resolve)(this.path, 'optimize');
this.targetLocation = (0, _path.resolve)(this.path, 'target');
this.productionDependencies = this.json.dependencies || {};
this.devDependencies = this.json.devDependencies || {};
Expand Down Expand Up @@ -7900,6 +7899,9 @@ class Project {
getIntermediateBuildDirectory() {
return (0, _path.resolve)(this.path, this.getBuildConfig().intermediateBuildDirectory || '.');
}
getCleanConfig() {
return this.json.kibana && this.json.kibana.clean || {};
}
hasScript(name) {
return name in this.scripts;
}
Expand Down Expand Up @@ -23153,28 +23155,46 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a
const CleanCommand = exports.CleanCommand = {
description: 'Remove the node_modules and target directories from all projects.',
name: 'clean',
run(projects, projectGraph, { rootPath }) {
run(projects) {
return _asyncToGenerator(function* () {
const directoriesToDelete = [];
const toDelete = [];
for (const project of projects.values()) {
if (yield (0, _fs.isDirectory)(project.nodeModulesLocation)) {
directoriesToDelete.push(project.nodeModulesLocation);
toDelete.push({
cwd: project.path,
pattern: (0, _path.relative)(project.path, project.nodeModulesLocation)
});
}
if (yield (0, _fs.isDirectory)(project.targetLocation)) {
directoriesToDelete.push(project.targetLocation);
toDelete.push({
cwd: project.path,
pattern: (0, _path.relative)(project.path, project.targetLocation)
});
}
if (yield (0, _fs.isDirectory)(project.optimizeLocation)) {
directoriesToDelete.push(project.optimizeLocation);
const { extraPatterns } = project.getCleanConfig();
if (extraPatterns) {
toDelete.push({
cwd: project.path,
pattern: extraPatterns
});
}
}
if (directoriesToDelete.length === 0) {
_log.log.write(_chalk2.default.bold.green('\n\nNo directories to delete'));
if (toDelete.length === 0) {
_log.log.write(_chalk2.default.bold.green('\n\nNothing to delete'));
} else {
_log.log.write(_chalk2.default.bold.red('\n\nDeleting directories:\n'));
for (const dir of directoriesToDelete) {
const deleting = (0, _del2.default)(dir, { force: true });
_ora2.default.promise(deleting, (0, _path.relative)(rootPath, dir));
yield deleting;
_log.log.write(_chalk2.default.bold.red('\n\nDeleting:\n'));
const originalCwd = process.cwd();
try {
for (const _ref of toDelete) {
const { pattern, cwd } = _ref;

process.chdir(cwd);
const promise = (0, _del2.default)(pattern);
_ora2.default.promise(promise, (0, _path.relative)(originalCwd, (0, _path.join)(cwd, String(pattern))));
yield promise;
}
} finally {
process.chdir(originalCwd);
}
}
})();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Array [
},
},
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/node_modules",
"optimizeLocation": "<repoRoot>/packages/kbn-pm/src/commands/optimize",
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/package.json",
"path": "<repoRoot>/packages/kbn-pm/src/commands",
"productionDependencies": Object {
Expand All @@ -46,7 +45,6 @@ Array [
"version": "1.0.0",
},
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
"optimizeLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/optimize",
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
"productionDependencies": Object {},
Expand All @@ -71,7 +69,6 @@ Array [
"version": "1.0.0",
},
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
"optimizeLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/optimize",
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
"productionDependencies": Object {},
Expand Down Expand Up @@ -105,7 +102,6 @@ Array [
"version": "1.0.0",
},
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
"optimizeLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/optimize",
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
"productionDependencies": Object {},
Expand Down
53 changes: 39 additions & 14 deletions packages/kbn-pm/src/commands/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import chalk from 'chalk';
import del from 'del';
import ora from 'ora';
import { relative } from 'path';
import { join, relative } from 'path';

import { isDirectory } from '../utils/fs';
import { log } from '../utils/log';
Expand All @@ -30,31 +30,56 @@ export const CleanCommand: ICommand = {
description: 'Remove the node_modules and target directories from all projects.',
name: 'clean',

async run(projects, projectGraph, { rootPath }) {
const directoriesToDelete = [];
async run(projects) {
const toDelete = [];
for (const project of projects.values()) {
if (await isDirectory(project.nodeModulesLocation)) {
directoriesToDelete.push(project.nodeModulesLocation);
toDelete.push({
cwd: project.path,
pattern: relative(project.path, project.nodeModulesLocation),
});
}

if (await isDirectory(project.targetLocation)) {
directoriesToDelete.push(project.targetLocation);
toDelete.push({
cwd: project.path,
pattern: relative(project.path, project.targetLocation),
});
}

if (await isDirectory(project.optimizeLocation)) {
directoriesToDelete.push(project.optimizeLocation);
const { extraPatterns } = project.getCleanConfig();
if (extraPatterns) {
toDelete.push({
cwd: project.path,
pattern: extraPatterns,
});
}
}

if (directoriesToDelete.length === 0) {
log.write(chalk.bold.green('\n\nNo directories to delete'));
if (toDelete.length === 0) {
log.write(chalk.bold.green('\n\nNothing to delete'));
} else {
log.write(chalk.bold.red('\n\nDeleting directories:\n'));
log.write(chalk.bold.red('\n\nDeleting:\n'));

for (const dir of directoriesToDelete) {
const deleting = del(dir, { force: true });
ora.promise(deleting, relative(rootPath, dir));
await deleting;
/**
* In order to avoid patterns like `/build` in packages from accidentally
* impacting files outside the package we use `process.chdir()` to change
* the cwd to the package and execute `del()` without the `force` option
* so it will check that each file being deleted is within the package.
*
* `del()` does support a `cwd` option, but it's only for resolving the
* patterns and does not impact the cwd check.
*/
const originalCwd = process.cwd();
try {
for (const { pattern, cwd } of toDelete) {
process.chdir(cwd);
const promise = del(pattern);
ora.promise(promise, relative(originalCwd, join(cwd, String(pattern))));
await promise;
}
} finally {
process.chdir(originalCwd);
}
}
},
Expand Down
Loading

0 comments on commit 8351171

Please sign in to comment.