Skip to content

Commit

Permalink
Merge branch 'main' into reporting/move-error-codes-to-output
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Feb 23, 2022
2 parents cc2c48e + 1249bfe commit 52877d6
Show file tree
Hide file tree
Showing 163 changed files with 5,970 additions and 1,391 deletions.
5 changes: 2 additions & 3 deletions docs/settings/reporting-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ available, but there will likely be errors in the visualizations in the report.
If capturing a report fails for any reason, {kib} will re-attempt other reporting job, as many times as this setting. Defaults to `3`.

`xpack.reporting.capture.loadDelay`::
Specify the {time-units}[amount of time] before taking a screenshot when visualizations are not evented. All visualizations that ship with {kib} are evented, so this setting should not have much effect. If you are seeing empty images instead of visualizations, try increasing this value. Defaults to `3s`.
deprecated:[8.0.0,This setting has no effect.] Specify the {time-units}[amount of time] before taking a screenshot when visualizations are not evented. All visualizations that ship with {kib} are evented, so this setting should not have much effect. If you are seeing empty images instead of visualizations, try increasing this value. Defaults to `3s`. *NOTE*: This setting exists for backwards compatibility, but is unused and therefore does not have an affect on reporting performance.

[float]
[[reporting-chromium-settings]]
Expand Down Expand Up @@ -220,8 +220,7 @@ Enables a check that warns you when there's a potential formula included in the
Escape formula values in cells with a `'`. See OWASP: https://www.owasp.org/index.php/CSV_Injection. Defaults to `true`.

`xpack.reporting.csv.enablePanelActionDownload`::
Enables CSV export from a saved search on a dashboard. This action is available in the dashboard panel menu for the saved search.
NOTE: This setting exists for backwards compatibility, but is unused and hardcoded to `true`. CSV export from a saved search on a dashboard is enabled when Reporting is enabled.
deprecated:[7.9.0,This setting has no effect.] Enables CSV export from a saved search on a dashboard. This action is available in the dashboard panel menu for the saved search. *NOTE*: This setting exists for backwards compatibility, but is unused and hardcoded to `true`. CSV export from a saved search on a dashboard is enabled when Reporting is enabled.

`xpack.reporting.csv.useByteOrderMarkEncoding`::
Adds a byte order mark (`\ufeff`) at the beginning of the CSV file. Defaults to `false`.
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The only number function that you can use with *clientip* is *Unique count*, als
. Open the *Visualization type* dropdown, then select *Metric*.
+
[role="screenshot"]
image::images/lens_visualizationTypeDropdown_7.16.png[Visualization type dropdown]
image::images/lens_visualizationTypeDropdown_8.0.png[Visualization type dropdown]

. From the *Available fields* list, drag *clientip* to the workspace or layer pane.
+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const initialInput: DashboardContainerInput = {
to: 'now',
from: 'now-1d',
},
timeRestore: false,
title: 'test',
query: {
query: '',
Expand Down
6 changes: 3 additions & 3 deletions fleet_packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
[
{
"name": "apm",
"version": "8.0.0"
"version": "8.1.0"
},
{
"name": "elastic_agent",
"version": "1.3.0"
},
{
"name": "endpoint",
"version": "1.4.1"
"version": "1.5.0"
},
{
"name": "fleet_server",
"version": "1.1.0"
},
{
"name": "synthetics",
"version": "0.9.0"
"version": "0.9.2"
}
]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"**/pdfkit/crypto-js": "4.0.0",
"**/react-syntax-highlighter": "^15.3.1",
"**/react-syntax-highlighter/**/highlight.js": "^10.4.1",
"**/refractor/prismjs": "~1.27.0",
"**/trim": "1.0.1",
"**/typescript": "4.5.3",
"**/underscore": "^1.13.1",
Expand Down
34 changes: 32 additions & 2 deletions src/core/public/notifications/toasts/toasts_api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ async function getCurrentToasts(toasts: ToastsApi) {

function uiSettingsMock() {
const mock = uiSettingsServiceMock.createSetupContract();
mock.get.mockImplementation(() => (config: string) => {
mock.get.mockImplementation((config: string) => {
switch (config) {
case 'notifications:lifetime:info':
return 5000;
case 'notifications:lifetime:warning':
return 10000;
case 'notification:lifetime:error':
case 'notifications:lifetime:error':
return 30000;
default:
throw new Error(`Accessing ${config} is not supported in the mock.`);
Expand Down Expand Up @@ -113,6 +113,12 @@ describe('#add()', () => {
const toasts = new ToastsApi(toastDeps());
expect(toasts.add('foo')).toHaveProperty('title', 'foo');
});

it('fallbacks to default values for undefined properties', async () => {
const toasts = new ToastsApi(toastDeps());
const toast = toasts.add({ title: 'foo', toastLifeTimeMs: undefined });
expect(toast.toastLifeTimeMs).toEqual(5000);
});
});

describe('#remove()', () => {
Expand Down Expand Up @@ -145,6 +151,12 @@ describe('#addInfo()', () => {
expect(currentToasts[0].toastLifeTimeMs).toBe(1);
expect(currentToasts[0]).toBe(toast);
});

it('fallbacks to default values for undefined properties', async () => {
const toasts = new ToastsApi(toastDeps());
const toast = toasts.addInfo({ title: 'foo', toastLifeTimeMs: undefined });
expect(toast.toastLifeTimeMs).toEqual(5000);
});
});

describe('#addSuccess()', () => {
Expand All @@ -159,6 +171,12 @@ describe('#addSuccess()', () => {
const currentToasts = await getCurrentToasts(toasts);
expect(currentToasts[0]).toBe(toast);
});

it('fallbacks to default values for undefined properties', async () => {
const toasts = new ToastsApi(toastDeps());
const toast = toasts.addSuccess({ title: 'foo', toastLifeTimeMs: undefined });
expect(toast.toastLifeTimeMs).toEqual(5000);
});
});

describe('#addWarning()', () => {
Expand All @@ -173,6 +191,12 @@ describe('#addWarning()', () => {
const currentToasts = await getCurrentToasts(toasts);
expect(currentToasts[0]).toBe(toast);
});

it('fallbacks to default values for undefined properties', async () => {
const toasts = new ToastsApi(toastDeps());
const toast = toasts.addWarning({ title: 'foo', toastLifeTimeMs: undefined });
expect(toast.toastLifeTimeMs).toEqual(10000);
});
});

describe('#addDanger()', () => {
Expand All @@ -187,6 +211,12 @@ describe('#addDanger()', () => {
const currentToasts = await getCurrentToasts(toasts);
expect(currentToasts[0]).toBe(toast);
});

it('fallbacks to default values for undefined properties', async () => {
const toasts = new ToastsApi(toastDeps());
const toast = toasts.addDanger({ title: 'foo', toastLifeTimeMs: undefined });
expect(toast.toastLifeTimeMs).toEqual(10000);
});
});

describe('#addError', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/core/public/notifications/toasts/toasts_api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { EuiGlobalToastListToast as EuiToast } from '@elastic/eui';
import React from 'react';
import * as Rx from 'rxjs';
import { omitBy, isUndefined } from 'lodash';

import { ErrorToast } from './error_toast';
import { MountPoint } from '../../types';
Expand Down Expand Up @@ -75,7 +76,7 @@ const normalizeToast = (toastOrTitle: ToastInput): ToastInputFields => {
title: toastOrTitle,
};
}
return toastOrTitle;
return omitBy(toastOrTitle, isUndefined);
};

/**
Expand Down
14 changes: 7 additions & 7 deletions src/dev/build/args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ it('build default and oss dist for current platform, without packages, by defaul
"dockerTagQualifier": null,
"downloadCloudDependencies": true,
"downloadFreshNode": true,
"eprRegistry": "snapshot",
"initialize": true,
"isRelease": false,
"targetAllPlatforms": false,
"useSnapshotEpr": false,
"versionQualifier": "",
},
"log": <ToolingLog>,
Expand Down Expand Up @@ -71,10 +71,10 @@ it('builds packages if --all-platforms is passed', () => {
"dockerTagQualifier": null,
"downloadCloudDependencies": true,
"downloadFreshNode": true,
"eprRegistry": "snapshot",
"initialize": true,
"isRelease": false,
"targetAllPlatforms": true,
"useSnapshotEpr": false,
"versionQualifier": "",
},
"log": <ToolingLog>,
Expand Down Expand Up @@ -102,10 +102,10 @@ it('limits packages if --rpm passed with --all-platforms', () => {
"dockerTagQualifier": null,
"downloadCloudDependencies": true,
"downloadFreshNode": true,
"eprRegistry": "snapshot",
"initialize": true,
"isRelease": false,
"targetAllPlatforms": true,
"useSnapshotEpr": false,
"versionQualifier": "",
},
"log": <ToolingLog>,
Expand Down Expand Up @@ -133,10 +133,10 @@ it('limits packages if --deb passed with --all-platforms', () => {
"dockerTagQualifier": null,
"downloadCloudDependencies": true,
"downloadFreshNode": true,
"eprRegistry": "snapshot",
"initialize": true,
"isRelease": false,
"targetAllPlatforms": true,
"useSnapshotEpr": false,
"versionQualifier": "",
},
"log": <ToolingLog>,
Expand Down Expand Up @@ -165,10 +165,10 @@ it('limits packages if --docker passed with --all-platforms', () => {
"dockerTagQualifier": null,
"downloadCloudDependencies": true,
"downloadFreshNode": true,
"eprRegistry": "snapshot",
"initialize": true,
"isRelease": false,
"targetAllPlatforms": true,
"useSnapshotEpr": false,
"versionQualifier": "",
},
"log": <ToolingLog>,
Expand Down Expand Up @@ -204,10 +204,10 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform
"dockerTagQualifier": null,
"downloadCloudDependencies": true,
"downloadFreshNode": true,
"eprRegistry": "snapshot",
"initialize": true,
"isRelease": false,
"targetAllPlatforms": true,
"useSnapshotEpr": false,
"versionQualifier": "",
},
"log": <ToolingLog>,
Expand Down Expand Up @@ -236,10 +236,10 @@ it('limits packages if --all-platforms passed with --skip-docker-ubuntu', () =>
"dockerTagQualifier": null,
"downloadCloudDependencies": true,
"downloadFreshNode": true,
"eprRegistry": "snapshot",
"initialize": true,
"isRelease": false,
"targetAllPlatforms": true,
"useSnapshotEpr": false,
"versionQualifier": "",
},
"log": <ToolingLog>,
Expand Down
17 changes: 15 additions & 2 deletions src/dev/build/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export function readCliArgs(argv: string[]) {
'silent',
'debug',
'help',
'use-snapshot-epr',
],
string: ['epr-registry'],
alias: {
v: 'verbose',
d: 'debug',
Expand All @@ -55,6 +55,7 @@ export function readCliArgs(argv: string[]) {
'docker-push': false,
'docker-tag-qualifier': null,
'version-qualifier': '',
'epr-registry': 'snapshot',
},
unknown: (flag) => {
unknownFlags.push(flag);
Expand Down Expand Up @@ -96,6 +97,18 @@ export function readCliArgs(argv: string[]) {
return Boolean(flags[name]);
}

const eprRegistry = flags['epr-registry'];
if (eprRegistry !== 'snapshot' && eprRegistry !== 'production') {
log.error(
`Invalid value for --epr-registry, must be 'production' or 'snapshot', got ${eprRegistry}`
);
return {
log,
showHelp: true,
unknownFlags: [],
};
}

const buildOptions: BuildOptions = {
isRelease: Boolean(flags.release),
versionQualifier: flags['version-qualifier'],
Expand All @@ -116,7 +129,7 @@ export function readCliArgs(argv: string[]) {
createDockerUBI: isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-ubi']),
createDockerContexts: !Boolean(flags['skip-docker-contexts']),
targetAllPlatforms: Boolean(flags['all-platforms']),
useSnapshotEpr: Boolean(flags['use-snapshot-epr']),
eprRegistry: flags['epr-registry'],
};

return {
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/build_distributables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface BuildOptions {
versionQualifier: string | undefined;
targetAllPlatforms: boolean;
createExamplePlugins: boolean;
useSnapshotEpr: boolean;
eprRegistry: 'production' | 'snapshot';
}

export async function buildDistributables(log: ToolingLog, options: BuildOptions): Promise<void> {
Expand Down
1 change: 1 addition & 0 deletions src/dev/build/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if (showHelp) {
--skip-node-download {dim Reuse existing downloads of node.js}
--verbose,-v {dim Turn on verbose logging}
--no-debug {dim Turn off debug logging}
--epr-registry {dim Specify the EPR registry to use for Fleet packages, 'production' or 'snapshot'}
`) + '\n'
);
process.exit(1);
Expand Down
7 changes: 4 additions & 3 deletions src/dev/build/tasks/bundle_fleet_packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ export const BundleFleetPackages: Task = {
// Support the `--use-snapshot-epr` command line argument to fetch from the snapshot registry
// in development or test environments
const { buildOptions } = readCliArgs(process.argv);
const eprUrl = buildOptions?.useSnapshotEpr
? 'https://epr-snapshot.elastic.co'
: 'https://epr.elastic.co';
const eprUrl =
buildOptions?.eprRegistry === 'snapshot'
? 'https://epr-snapshot.elastic.co'
: 'https://epr.elastic.co';

const configFilePath = config.resolveFromRepo('fleet_packages.json');
const fleetPackages = (await read(configFilePath)) || '[]';
Expand Down
8 changes: 2 additions & 6 deletions src/fixtures/telemetry_collectors/enum_collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
* Side Public License, v 1.
*/

import { CollectorSet } from '../../plugins/usage_collection/server/collector';
import { loggerMock } from '../../core/server/logging/logger.mock';
import { createUsageCollectionSetupMock } from '../../plugins/usage_collection/server/mocks';

const { makeUsageCollector } = new CollectorSet({
logger: loggerMock.create(),
maximumWaitTimeForAllCollectorsInS: 0,
});
const { makeUsageCollector } = createUsageCollectionSetupMock();

enum TELEMETRY_LAYER_TYPE {
ES_DOCS = 'es_docs',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@
* Side Public License, v 1.
*/

import {
CollectorSet,
UsageCollectorOptions,
} from '../../plugins/usage_collection/server/collector';
import { loggerMock } from '../../core/server/logging/logger.mock';
import type { UsageCollectorOptions } from 'src/plugins/usage_collection/server';
import { createUsageCollectionSetupMock } from '../../plugins/usage_collection/server/mocks';

const collectorSet = new CollectorSet({
logger: loggerMock.create(),
maximumWaitTimeForAllCollectorsInS: 0,
});
const collectorSet = createUsageCollectionSetupMock();

interface Usage {
locale: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
* Side Public License, v 1.
*/

import { CollectorSet } from '../../../plugins/usage_collection/server/collector';
import { loggerMock } from '../../../core/server/logging/logger.mock';
import type { Usage } from './types';
import { createUsageCollectionSetupMock } from '../../../plugins/usage_collection/server/mocks';

const { makeUsageCollector } = new CollectorSet({
logger: loggerMock.create(),
maximumWaitTimeForAllCollectorsInS: 0,
});
const { makeUsageCollector } = createUsageCollectionSetupMock();

export const myCollector = makeUsageCollector<Usage, false>({
type: 'importing_from_export_collector',
Expand Down
8 changes: 2 additions & 6 deletions src/fixtures/telemetry_collectors/imported_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
* Side Public License, v 1.
*/

import { CollectorSet } from '../../plugins/usage_collection/server/collector';
import { loggerMock } from '../../core/server/logging/logger.mock';
import { createUsageCollectionSetupMock } from '../../plugins/usage_collection/server/mocks';
import { externallyDefinedSchema } from './constants';

const { makeUsageCollector } = new CollectorSet({
logger: loggerMock.create(),
maximumWaitTimeForAllCollectorsInS: 0,
});
const { makeUsageCollector } = createUsageCollectionSetupMock();

interface Usage {
locale?: string;
Expand Down
Loading

0 comments on commit 52877d6

Please sign in to comment.