Skip to content

Commit 8fb5dd6

Browse files
author
Aaron Caldwell
committed
Merge remote-tracking branch 'upstream/master' into file-upload-route-validation
2 parents c8c334c + 6e1328b commit 8fb5dd6

545 files changed

Lines changed: 11414 additions & 8091 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,6 @@ module.exports = {
177177
'react-hooks/exhaustive-deps': 'off',
178178
},
179179
},
180-
{
181-
files: ['x-pack/legacy/plugins/monitoring/**/*.{js,ts,tsx}'],
182-
rules: {
183-
'jsx-a11y/click-events-have-key-events': 'off',
184-
},
185-
},
186180
{
187181
files: ['x-pack/legacy/plugins/snapshot_restore/**/*.{js,ts,tsx}'],
188182
rules: {
@@ -729,15 +723,13 @@ module.exports = {
729723
'no-unreachable': 'error',
730724
'no-unsafe-finally': 'error',
731725
'no-useless-call': 'error',
732-
// This will be turned on after bug fixes are mostly complete
733-
// 'no-useless-catch': 'warn',
726+
'no-useless-catch': 'error',
734727
'no-useless-concat': 'error',
735728
'no-useless-computed-key': 'error',
736729
// This will be turned on after bug fixes are mostly complete
737730
// 'no-useless-escape': 'warn',
738731
'no-useless-rename': 'error',
739-
// This will be turned on after bug fixes are mostly complete
740-
// 'no-useless-return': 'warn',
732+
'no-useless-return': 'error',
741733
// This will be turned on after bug fixers are mostly complete
742734
// 'no-void': 'warn',
743735
'one-var-declaration-per-line': 'error',
@@ -751,8 +743,7 @@ module.exports = {
751743
'react/button-has-type': 'error',
752744
'react/forbid-dom-props': 'error',
753745
'react/no-access-state-in-setstate': 'error',
754-
// This style will be turned on after most bugs are fixed
755-
// 'react/no-children-prop': 'warn',
746+
'react/no-children-prop': 'error',
756747
'react/no-danger-with-children': 'error',
757748
'react/no-deprecated': 'error',
758749
'react/no-did-mount-set-state': 'error',
@@ -814,21 +805,6 @@ module.exports = {
814805
},
815806
},
816807

817-
/**
818-
* Monitoring overrides
819-
*/
820-
{
821-
files: ['x-pack/legacy/plugins/monitoring/**/*.js'],
822-
rules: {
823-
'no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }],
824-
'no-else-return': 'error',
825-
},
826-
},
827-
{
828-
files: ['x-pack/legacy/plugins/monitoring/public/**/*.js'],
829-
env: { browser: true },
830-
},
831-
832808
/**
833809
* Canvas overrides
834810
*/
110 KB
Loading

docs/user/reporting/index.asciidoc

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
--
88

9-
You can generate a report that contains a {kib} dashboard, visualization,
10-
saved search, or Canvas workpad. Depending on the object type, you can export the data as
9+
You can generate a report that contains a {kib} dashboard, visualization,
10+
saved search, or Canvas workpad. Depending on the object type, you can export the data as
1111
a PDF, PNG, or CSV document, which you can keep for yourself, or share with others.
1212

13-
Reporting is available from the *Share* menu
13+
Reporting is available from the *Share* menu
1414
in *Discover*, *Visualize*, *Dashboard*, and *Canvas*.
1515

1616
[role="screenshot"]
@@ -40,9 +40,9 @@ for an example.
4040
[[manually-generate-reports]]
4141
== Generate a report manually
4242

43-
. Open the dashboard, visualization, Canvas workpad, or saved search that you want to include in the report.
43+
. Open the dashboard, visualization, Canvas workpad, or saved search that you want to include in the report.
4444

45-
. In the {kib} toolbar, click *Share*. If you are working in Canvas,
45+
. In the {kib} toolbar, click *Share*. If you are working in Canvas,
4646
click the share icon image:user/reporting/images/canvas-share-button.png["Canvas Share button"].
4747

4848
. Select the option appropriate for your object. You can export:
@@ -55,14 +55,36 @@ click the share icon image:user/reporting/images/canvas-share-button.png["Canvas
5555
+
5656
A notification appears when the report is complete.
5757

58+
[float]
59+
[[reporting-layout-sizing]]
60+
== Layout and sizing
61+
The layout and size of the PDF or PNG image depends on the {kib} app
62+
with which the Reporting plugin is integrated. For Canvas, the
63+
worksheet dimensions determine the size for Reporting. In other apps,
64+
the dimensions are taken on the fly by looking at
65+
the size of the visualization elements or panels on the page.
66+
67+
The size dimensions are part of the reporting job parameters. Therefore, to
68+
make the report output larger or smaller, you can change the size of the browser.
69+
This resizes the shareable container before generating the
70+
report, so the desired dimensions are passed in the job parameters.
71+
72+
In the following {kib} dashboard, the shareable container is highlighted.
73+
The shareable container is captured when you click the
74+
*Generate* or *Copy POST URL* button. It might take some trial and error
75+
before you're satisfied with the layout and dimensions in the resulting
76+
PNG or PDF image.
77+
78+
[role="screenshot"]
79+
image::user/reporting/images/shareable-container.png["Shareable Container"]
80+
81+
82+
5883
[float]
5984
[[optimize-pdf]]
6085
== Optimize PDF for print—dashboard only
6186

62-
By default, {kib} creates a PDF
63-
using the existing layout and size of the dashboard. To create a
64-
printer-friendly PDF with multiple A4 portrait pages and two visualizations
65-
per page, turn on *Optimize for printing*.
87+
To create a printer-friendly PDF with multiple A4 portrait pages and two visualizations per page, turn on *Optimize for printing*.
6688

6789
[role="screenshot"]
6890
image::user/reporting/images/preserve-layout-switch.png["Share"]
@@ -72,8 +94,8 @@ image::user/reporting/images/preserve-layout-switch.png["Share"]
7294
[[manage-report-history]]
7395
== View and manage report history
7496

75-
For a list of your reports, go to *Management > Reporting*.
76-
From this view, you can monitor the generation of a report and
97+
For a list of your reports, go to *Management > Reporting*.
98+
From this view, you can monitor the generation of a report and
7799
download reports that you previously generated.
78100

79101
[float]

docs/user/reporting/reporting-troubleshooting.asciidoc

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@
77

88
Having trouble? Here are solutions to common problems you might encounter while using Reporting.
99

10+
* <<reporting-troubleshooting-system-dependencies>>
11+
* <<reporting-troubleshooting-text-incorrect>>
12+
* <<reporting-troubleshooting-missing-data>>
13+
* <<reporting-troubleshooting-file-permissions>>
14+
* <<reporting-troubleshooting-error-messages>>
15+
* <<reporting-troubleshooting-puppeteer-debug-logs>>
16+
* <<reporting-troubleshooting-system-requirements>>
17+
1018
[float]
1119
[[reporting-troubleshooting-system-dependencies]]
1220
=== System dependencies
1321
Reporting launches a "headless" web browser called Chromium on the Kibana server. It is a custom build made by Elastic of an open source
1422
project, and it is intended to have minimal dependencies on OS libraries. However, the Kibana server OS might still require additional
15-
dependencies for Chromium.
23+
dependencies to run the Chromium executable.
1624

1725
Make sure Kibana server OS has the appropriate packages installed for the distribution.
1826

@@ -33,19 +41,30 @@ If you are using Ubuntu/Debian systems, install the following packages:
3341
* `fonts-liberation`
3442
* `libfontconfig1`
3543

44+
If the system is missing dependencies, then Reporting will fail in a non-deterministic way. {kib} runs a self-test at server startup, and
45+
if it encounters errors, logs them in the Console. Unfortunately, the error message does not include
46+
information about why Chromium failed to run. The most common error message is `Error: connect ECONNREFUSED`, which indicates
47+
that {kib} could not connect to the Chromium process.
48+
49+
To troubleshoot the problem, start the {kib} server with environment variables that tell Chromium to print verbose logs. See the
50+
<<reporting-troubleshooting-puppeteer-debug-logs, Puppeteer debug method>> for more information.
51+
3652
[float]
37-
=== Text is rendered incorrectly in generated reports
53+
[[reporting-troubleshooting-text-incorrect]]
54+
=== Text rendered incorrectly in generated reports
3855

3956
If a report label is rendered as an empty rectangle, no system fonts are available. Install at least one font package on the system.
4057

4158
If the report is missing certain Chinese, Japanese or Korean characters, ensure that a system font with those characters is installed.
4259

4360
[float]
61+
[[reporting-troubleshooting-missing-data]]
4462
=== Missing data in PDF report of data table visualization
4563
There is currently a known limitation with the Data Table visualization that only the first page of data rows, which are the only data
4664
visible on the screen, are shown in PDF reports.
4765

4866
[float]
67+
[[reporting-troubleshooting-file-permissions]]
4968
=== File permissions
5069
Ensure that the `headless_shell` binary located in your Kibana data directory is owned by the user who is running Kibana, that the
5170
user has the execute permission, and if applicable, that the filesystem is mounted with the `exec` option.
@@ -63,25 +82,25 @@ Whenever possible, a Reporting error message tries to be as self-explanatory as
6382
along with the solution.
6483

6584
[float]
66-
==== "Max attempts reached"
85+
==== Max attempts reached
6786
There are two primary causes of this error:
6887

69-
. You're creating a PDF of a visualization or dashboard that spans a large amount of data and Kibana is hitting the `xpack.reporting.queue.timeout`
88+
* You're creating a PDF of a visualization or dashboard that spans a large amount of data and Kibana is hitting the `xpack.reporting.queue.timeout`
7089

71-
. Kibana is hosted behind a reverse-proxy, and the <<reporting-kibana-server-settings, Kibana server settings>> are not configured correctly
90+
* Kibana is hosted behind a reverse-proxy, and the <<reporting-kibana-server-settings, Kibana server settings>> are not configured correctly
7291

7392
Create a Markdown visualization and then create a PDF report. If this succeeds, increase the `xpack.reporting.queue.timeout` setting. If the
7493
PDF report fails with "Max attempts reached," check your <<reporting-kibana-server-settings, Kibana server settings>>.
7594

7695
[float]
7796
[[reporting-troubleshooting-nss-dependency]]
78-
==== "You must install nss for Reporting to work"
97+
==== You must install nss for Reporting to work
7998
Reporting using the Chromium browser relies on the Network Security Service libraries (NSS). Install the appropriate nss package for your
8099
distribution.
81100

82101
[float]
83102
[[reporting-troubleshooting-sandbox-dependency]]
84-
==== "Unable to use Chromium sandbox"
103+
==== Unable to use Chromium sandbox
85104
Chromium uses sandboxing techniques that are built on top of operating system primitives. The Linux sandbox depends on user namespaces,
86105
which were introduced with the 3.8 Linux kernel. However, many distributions don't have user namespaces enabled by default, or they require
87106
the CAP_SYS_ADMIN capability.
@@ -90,6 +109,7 @@ Elastic recommends that you research the feasibility of enabling unprivileged us
90109
is if you are running Kibana in Docker because the container runs in a user namespace with the built-in seccomp/bpf filters.
91110

92111
[float]
112+
[[reporting-troubleshooting-verbose-logs]]
93113
=== Verbose logs
94114
{kib} server logs have a lot of useful information for troubleshooting and understanding how things work. If you're having any issues at
95115
all, the full logs from Reporting will be the first place to look. In `kibana.yml`:
@@ -101,10 +121,12 @@ logging.verbose: true
101121

102122
For more information about logging, see <<logging-verbose,Kibana configuration settings>>.
103123

124+
[float]
125+
[[reporting-troubleshooting-puppeteer-debug-logs]]
104126
=== Puppeteer debug logs
105127
The Chromium browser that {kib} launches on the server is driven by a NodeJS library for Chromium called Puppeteer. The Puppeteer library
106128
has its own command-line method to generate its own debug logs, which can sometimes be helpful, particularly to figure out if a problem is
107-
caused by Kibana or Chromium. See more at https://github.com/GoogleChrome/puppeteer/blob/v1.19.0/README.md#debugging-tips
129+
caused by Kibana or Chromium. See more at https://github.com/GoogleChrome/puppeteer/blob/v1.19.0/README.md#debugging-tips[debugging tips].
108130

109131
Using Puppeteer's debug method when launching Kibana would look like:
110132
```
@@ -114,3 +136,14 @@ The internal DevTools protocol traffic will be logged via the `debug` module und
114136

115137

116138
The Puppeteer logs are very verbose and could possibly contain sensitive information. Handle the generated output with care.
139+
140+
[float]
141+
[[reporting-troubleshooting-system-requirements]]
142+
=== System requirements
143+
In Elastic Cloud, the {kib} instances that most configurations provide by default is for 1GB of RAM for the instance. That is enough for
144+
{kib} Reporting when the visualization or dashboard is relatively simple, such as a single pie chart or a dashboard with
145+
a few visualizations. However, certain visualization types incur more load than others. For example, a TSVB panel has a lot of network
146+
requests to render.
147+
148+
If the {kib} instance doesn't have enough memory to run the report, the report fails with an error such as `Error: Page crashed!`
149+
In this case, try increasing the memory for the {kib} instance to 2GB.

docs/user/security/reporting.asciidoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,30 @@ that provides read and write privileges in
5757
Go to *Management > Users*, add a new user, and assign the user the built-in
5858
`reporting_user` role and your new custom role, `custom_reporting_user`.
5959

60+
[float]
61+
==== With a custom index
62+
63+
If you are using Reporting with a custom index,
64+
the `xpack.reporting.index` setting should begin
65+
with `.reporting-*`. The default {kib} system user has
66+
`all` privileges against the `.reporting-*` pattern of indices.
67+
68+
[source,js]
69+
xpack.reporting.index: '.reporting-custom-index'
70+
71+
If you use a different pattern for the `xpack.reporting.index` setting,
72+
you must create a custom role with appropriate access to the index, similar
73+
to the following:
74+
75+
. Go to *Management > Roles*, and click *Create role*.
76+
. Name the role `custom-reporting-user`.
77+
. Specify the custom index and assign it the `all` index privilege.
78+
. Go to *Management > Users* and create a new user with
79+
the `kibana_system` role and the `custom-reporting-user` role.
80+
. Configure {kib} to use the new account:
81+
[source,js]
82+
elasticsearch.username: 'custom_kibana_system'
83+
6084
[float]
6185
[[reporting-roles-user-api]]
6286
==== With the user API

packages/kbn-analytics/src/report.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export class ReportManager {
7878
}
7979
assignReports(newMetrics: Metric | Metric[]) {
8080
wrapArray(newMetrics).forEach(newMetric => this.assignReport(this.report, newMetric));
81+
return { report: this.report };
8182
}
8283
static createMetricKey(metric: Metric): string {
8384
switch (metric.type) {
@@ -101,7 +102,7 @@ export class ReportManager {
101102
case METRIC_TYPE.USER_AGENT: {
102103
const { appName, type, userAgent } = metric;
103104
if (userAgent) {
104-
this.report.userAgent = {
105+
report.userAgent = {
105106
[key]: {
106107
key,
107108
appName,
@@ -110,23 +111,22 @@ export class ReportManager {
110111
},
111112
};
112113
}
114+
113115
return;
114116
}
115117
case METRIC_TYPE.CLICK:
116118
case METRIC_TYPE.LOADED:
117119
case METRIC_TYPE.COUNT: {
118120
const { appName, type, eventName, count } = metric;
119-
if (report.uiStatsMetrics) {
120-
const existingStats = (report.uiStatsMetrics[key] || {}).stats;
121-
this.report.uiStatsMetrics = this.report.uiStatsMetrics || {};
122-
this.report.uiStatsMetrics[key] = {
123-
key,
124-
appName,
125-
eventName,
126-
type,
127-
stats: this.incrementStats(count, existingStats),
128-
};
129-
}
121+
report.uiStatsMetrics = report.uiStatsMetrics || {};
122+
const existingStats = (report.uiStatsMetrics[key] || {}).stats;
123+
report.uiStatsMetrics[key] = {
124+
key,
125+
appName,
126+
eventName,
127+
type,
128+
stats: this.incrementStats(count, existingStats),
129+
};
130130
return;
131131
}
132132
default:

src/core/server/rendering/views/styles.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ interface Props {
2828
}
2929

3030
export const Styles: FunctionComponent<Props> = ({ darkMode }) => {
31-
const themeBackground = darkMode ? '#25262e' : '#f5f7fa';
32-
3331
return (
3432
<style
3533
dangerouslySetInnerHTML={{
@@ -42,11 +40,9 @@ export const Styles: FunctionComponent<Props> = ({ darkMode }) => {
4240
width: 100%;
4341
height: 100%;
4442
margin: 0;
45-
background-color: ${themeBackground};
4643
}
4744
4845
.kibanaWelcomeView {
49-
background-color: ${themeBackground};
5046
height: 100%;
5147
display: -webkit-box;
5248
display: -webkit-flex;

src/legacy/core_plugins/console/public/kibana.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"version": "kibana",
44
"server": true,
55
"ui": true,
6-
"requiredPlugins": ["home"]
6+
"requiredPlugins": ["home"],
7+
"optionalPlugins": ["usageCollection"]
78
}

src/legacy/core_plugins/console/public/legacy.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ import { I18nContext } from 'ui/i18n';
2222
import chrome from 'ui/chrome';
2323
import { FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';
2424

25+
import { plugin } from './np_ready';
26+
import { DevToolsSetup } from '../../../../plugins/dev_tools/public';
27+
import { HomePublicPluginSetup } from '../../../../plugins/home/public';
28+
import { UsageCollectionSetup } from '../../../../plugins/usage_collection/public';
29+
2530
export interface XPluginSet {
31+
usageCollection: UsageCollectionSetup;
2632
dev_tools: DevToolsSetup;
2733
home: HomePublicPluginSetup;
2834
__LEGACY: {
@@ -32,10 +38,6 @@ export interface XPluginSet {
3238
};
3339
}
3440

35-
import { plugin } from './np_ready';
36-
import { DevToolsSetup } from '../../../../plugins/dev_tools/public';
37-
import { HomePublicPluginSetup } from '../../../../plugins/home/public';
38-
3941
const pluginInstance = plugin({} as any);
4042

4143
(async () => {

0 commit comments

Comments
 (0)