Skip to content

Commit

Permalink
Merge branch 'master' into kibana-page-template-ws-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Constance committed Jun 17, 2021
2 parents aebdca9 + 0e14cef commit be40d6b
Show file tree
Hide file tree
Showing 324 changed files with 5,453 additions and 3,111 deletions.
40 changes: 18 additions & 22 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -261,52 +261,48 @@ The plugin exposes the static DefaultEditorController class to consume.
|The markdown visualization that can be used to place text panels on dashboards.
|{kib-repo}blob/{branch}/src/plugins/vis_type_metric/README.md[visTypeMetric]
|Contains the metric visualization.
|{kib-repo}blob/{branch}/src/plugins/vis_type_metric[visTypeMetric]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_pie/README.md[visTypePie]
|Contains the pie chart implementation using the elastic-charts library. The goal is to eventually deprecate the old implementation and keep only this. Until then, the library used is defined by the Legacy charts library advanced setting.
|{kib-repo}blob/{branch}/src/plugins/vis_type_pie[visTypePie]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_table/README.md[visTypeTable]
|Contains the data table visualization, that allows presenting data in a simple table format.
|{kib-repo}blob/{branch}/src/plugins/vis_type_tagcloud/README.md[visTypeTagcloud]
|Contains the tagcloud visualization.
|{kib-repo}blob/{branch}/src/plugins/vis_type_tagcloud[visTypeTagcloud]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_timelion/README.md[visTypeTimelion]
|Contains the timelion visualization and the timelion backend.
|{kib-repo}blob/{branch}/src/plugins/vis_type_timeseries/README.md[visTypeTimeseries]
|Contains everything around TSVB (the editor, visualizatin implementations and backends).
|{kib-repo}blob/{branch}/src/plugins/vis_type_timeseries[visTypeTimeseries]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_vega/README.md[visTypeVega]
|Contains the Vega visualization.
|{kib-repo}blob/{branch}/src/plugins/vis_type_vega[visTypeVega]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_vislib/README.md[visTypeVislib]
|Contains the vislib visualizations. These are the classical area/line/bar, pie, gauge/goal and
heatmap charts.
|{kib-repo}blob/{branch}/src/plugins/vis_type_vislib[visTypeVislib]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_xy/README.md[visTypeXy]
|Contains the new xy-axis chart using the elastic-charts library, which will eventually
replace the vislib xy-axis charts including bar, area, and line.
|{kib-repo}blob/{branch}/src/plugins/vis_type_xy[visTypeXy]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/visualizations/README.md[visualizations]
|Contains most of the visualization infrastructure, e.g. the visualization type registry or the
visualization embeddable.
|{kib-repo}blob/{branch}/src/plugins/visualizations[visualizations]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/visualize/README.md[visualize]
|Contains the visualize application which includes the listing page and the app frame,
which will load the visualization's editor.
|{kib-repo}blob/{branch}/src/plugins/visualize[visualize]
|WARNING: Missing README.
|===
Expand Down
Binary file added docs/user/dashboard/images/lens_time_shift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions docs/user/dashboard/lens-advanced.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,41 @@ image::images/lens_advanced_5_2.png[Line chart with cumulative sum of orders mad

. Click *Save and return*.

[discrete]
[[compare-time-ranges]]
=== Compare time ranges

*Lens* allows you to compare the currently selected time range with historical data using the *Time shift* option.

Time shifts can be used on any metric. The special shift *previous* will show the time window preceding the currently selected one, spanning the same duration.
For example, if *Last 7 days* is selected in the time filter, *previous* will show data from 14 days ago to 7 days ago.

If multiple time shifts are used in a single chart, a multiple of the date histogram interval should be chosen - otherwise data points might not line up in the chart and empty spots can occur.
For example, if a daily interval is used, shifting one series by *36h*, and another one by *1d*, is not recommended. In this scenario, either reduce the interval to *12h*, or create two separate charts.

To compare current sales numbers with sales from a week ago, follow these steps:

. Open *Lens*.

. From the *Chart Type* dropdown, select *Line*.

. From the *Available fields* list, drag and drop *Records* to the visualization builder.

. Copy the *Count of Records* series by dragging it to the empty drop target of the *Vertical axis* dimension group (*Drop a field or click to add*)

. Shift the second *Count of Records* series by one week to do a week-over-week comparison

.. Click the new *Count of Records [1]* dimension

.. Click *Add advanced options* below the field selector

.. Click *Time shift*

.. Click the *1 week* option. You can also define custom shifts by typing amount followed by time unit (like *1w* for a one week shift), then hit enter.

[role="screenshot"]
image::images/lens_time_shift.png[Line chart with week-over-week sales comparison]

[discrete]
[[view-customers-over-time-by-continents]]
=== View table of customers by category over time
Expand Down
19 changes: 19 additions & 0 deletions docs/user/dashboard/lens.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,22 @@ Pagination in a data table is unsupported in *Lens*. However, the <<types-of-vis
===== Is it possible to have more than one y-axis scale in visualizations?

*Lens* lets you pick, for each Y dimension, up to two distinct axis: *left* and *right*. Each axis can have a different scale.

[float]
[[why-is-my-value-with-the-right-color-using-value-based-coloring]]
===== Why is my value with the incorrect color when using value-based coloring?

There could be various reasons for a specific value in the table to have a different color than expected.

Here's a short list of few different aspects to check:
* Make sure the value falls within the desired color stop value defined in the panel. Color stop values are "inclusive".

* Make sure you have the right value precision setup: value formatters could round the numeric values up or down.

* Make sure the right color continuity option is selected: if the number is below the first color stop value, a continuity of type `Below` or `Above and below range` is required.

* The default values set by the Value type are based on the current data range displayed on the data table.

** If a custom `Number` configuration is used, check that the color stop values are covering the current data range.

** If a `Percent` configuration is used, and the data range changes, the colors displayed are affected.
13 changes: 13 additions & 0 deletions packages/kbn-test/src/functional_test_runner/lib/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@ export const schema = Joi.object()
sourceArgs: Joi.array(),
serverArgs: Joi.array(),
installDir: Joi.string(),
/** Options for how FTR should execute and interact with Kibana */
runOptions: Joi.object()
.keys({
/**
* Log message to wait for before initiating tests, defaults to waiting for Kibana status to be `available`.
* Note that this log message must not be filtered out by the current logging config, for example by the
* log level. If needed, you can adjust the logging level via `kbnTestServer.serverArgs`.
*/
wait: Joi.object()
.regex()
.default(/Kibana is now available/),
})
.default(),
})
.default(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function extendNodeOptions(installDir) {

export async function runKibanaServer({ procs, config, options }) {
const { installDir } = options;
const runOptions = config.get('kbnTestServer.runOptions');

await procs.run('kibana', {
cmd: getKibanaCmd(installDir),
Expand All @@ -38,7 +39,7 @@ export async function runKibanaServer({ procs, config, options }) {
...extendNodeOptions(installDir),
},
cwd: installDir || KIBANA_ROOT,
wait: /\[Kibana\]\[http\] http server running/,
wait: runOptions.wait,
});
}

Expand Down
6 changes: 0 additions & 6 deletions packages/kbn-test/src/functional_tests/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ export async function runTests(options) {
try {
es = await runElasticsearch({ config, options: opts });
await runKibanaServer({ procs, config, options: opts });
// workaround until https://github.com/elastic/kibana/issues/89828 is addressed
await delay(5000);
await runFtr({ configPath, options: opts });
} finally {
try {
Expand Down Expand Up @@ -164,7 +162,3 @@ async function silence(log, milliseconds) {
)
.toPromise();
}

async function delay(ms) {
await new Promise((resolve) => setTimeout(resolve, ms));
}
11 changes: 4 additions & 7 deletions rfcs/text/0011_global_search.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
A new Kibana plugin exposing an API on both public and server side, to allow consumers to search for various objects and
register result providers.

Note: whether this will be an oss or xpack plugin still depends on https://github.com/elastic/dev/issues/1404.

# Basic example

- registering a result provider:
Expand Down Expand Up @@ -43,8 +41,7 @@ Kibana should do its best to assist users searching for and navigating to the va

We should expose an API to make it possible for plugins to search for the various objects present on a Kibana instance.

The first consumer of this API will be the global search bar [#57576](https://github.com/elastic/kibana/issues/57576). This API
should still be generic to answer similar needs from any other consumer, either client or server side.
The first consumer of this API will be the global search bar [#57576](https://github.com/elastic/kibana/issues/57576). This API should still be generic to answer similar needs from any other consumer, either client or server side.

# Detailed design

Expand Down Expand Up @@ -84,7 +81,7 @@ interface GlobalSearchProviderFindOptions {
aborted$: Observable<void>;
/**
* The total maximum number of results (including all batches / emissions) that should be returned by the provider for a given `find` request.
* Any result emitted exceeding this quota will be ignored by the service and not emitted to the consumer.
* Any result emitted exceeding this quota will be ignored by the service and not emitted to the consumer.
*/
maxResults: number;
}
Expand Down Expand Up @@ -462,8 +459,8 @@ search(

Notes:

- The example implementation is not streaming results from the server, meaning that all results from server-side
registered providers will all be fetched and emitted in a single batch. Ideally, we would leverage the `bfetch` plugin
- The example implementation is not streaming results from the server, meaning that all results from server-side
registered providers will all be fetched and emitted in a single batch. Ideally, we would leverage the `bfetch` plugin
to stream the results to the client instead.

### results sorting
Expand Down
1 change: 1 addition & 0 deletions src/core/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export class Server {

await this.plugins.start(this.coreStart);

this.status.start();
await this.http.start();

startTransaction?.end();
Expand Down
103 changes: 103 additions & 0 deletions src/core/server/status/log_overall_status.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { TestScheduler } from 'rxjs/testing';
import { ServiceStatus, ServiceStatusLevels } from './types';
import { getOverallStatusChanges } from './log_overall_status';

const getTestScheduler = () =>
new TestScheduler((actual, expected) => {
expect(actual).toEqual(expected);
});

const createStatus = (parts: Partial<ServiceStatus> = {}): ServiceStatus => ({
level: ServiceStatusLevels.available,
summary: 'summary',
...parts,
});

describe('getOverallStatusChanges', () => {
it('emits an initial message after first overall$ emission', () => {
getTestScheduler().run(({ expectObservable, hot }) => {
const overall$ = hot<ServiceStatus>('--a', {
a: createStatus(),
});
const stop$ = hot<void>('');
const expected = '--a';

expectObservable(getOverallStatusChanges(overall$, stop$)).toBe(expected, {
a: 'Kibana is now available',
});
});
});

it('emits a new message every time the status level changes', () => {
getTestScheduler().run(({ expectObservable, hot }) => {
const overall$ = hot<ServiceStatus>('--a--b', {
a: createStatus({
level: ServiceStatusLevels.degraded,
}),
b: createStatus({
level: ServiceStatusLevels.available,
}),
});
const stop$ = hot<void>('');
const expected = '--a--b';

expectObservable(getOverallStatusChanges(overall$, stop$)).toBe(expected, {
a: 'Kibana is now degraded',
b: 'Kibana is now available (was degraded)',
});
});
});

it('does not emit when the status stays the same', () => {
getTestScheduler().run(({ expectObservable, hot }) => {
const overall$ = hot<ServiceStatus>('--a--b--c', {
a: createStatus({
level: ServiceStatusLevels.degraded,
summary: 'summary 1',
}),
b: createStatus({
level: ServiceStatusLevels.degraded,
summary: 'summary 2',
}),
c: createStatus({
level: ServiceStatusLevels.available,
summary: 'summary 2',
}),
});
const stop$ = hot<void>('');
const expected = '--a-----b';

expectObservable(getOverallStatusChanges(overall$, stop$)).toBe(expected, {
a: 'Kibana is now degraded',
b: 'Kibana is now available (was degraded)',
});
});
});

it('stops emitting once `stop$` emits', () => {
getTestScheduler().run(({ expectObservable, hot }) => {
const overall$ = hot<ServiceStatus>('--a--b', {
a: createStatus({
level: ServiceStatusLevels.degraded,
}),
b: createStatus({
level: ServiceStatusLevels.available,
}),
});
const stop$ = hot<void>('----(s|)');
const expected = '--a-|';

expectObservable(getOverallStatusChanges(overall$, stop$)).toBe(expected, {
a: 'Kibana is now degraded',
});
});
});
});
31 changes: 31 additions & 0 deletions src/core/server/status/log_overall_status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { Observable } from 'rxjs';
import { distinctUntilChanged, pairwise, startWith, takeUntil, map } from 'rxjs/operators';
import { ServiceStatus } from './types';

export const getOverallStatusChanges = (
overall$: Observable<ServiceStatus>,
stop$: Observable<void>
) => {
return overall$.pipe(
takeUntil(stop$),
distinctUntilChanged((previous, next) => {
return previous.level.toString() === next.level.toString();
}),
startWith(undefined),
pairwise(),
map(([oldStatus, newStatus]) => {
if (oldStatus) {
return `Kibana is now ${newStatus!.level.toString()} (was ${oldStatus!.level.toString()})`;
}
return `Kibana is now ${newStatus!.level.toString()}`;
})
);
};
4 changes: 2 additions & 2 deletions src/core/server/status/plugins_status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ describe('PluginStatusService', () => {
pluginA$.next(available);
pluginA$.next(degraded);
// Waiting for the debounce timeout should cut a new update
await delay(500);
await delay(25);
pluginA$.next(available);
await delay(500);
await delay(25);
subscription.unsubscribe();

expect(statusUpdates).toMatchInlineSnapshot(`
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/status/plugins_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class PluginsStatusService {

return this.getPluginStatuses$(dependencies).pipe(
// Prevent many emissions at once from dependency status resolution from making this too noisy
debounceTime(500)
debounceTime(25)
);
}

Expand Down
Loading

0 comments on commit be40d6b

Please sign in to comment.