Skip to content

Commit

Permalink
Merge branch 'master' into monitoring/constructor_name
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jan 6, 2021
2 parents 3ce1a3b + 316346a commit 92d0b90
Show file tree
Hide file tree
Showing 260 changed files with 3,560 additions and 1,831 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@
/x-pack/test/functional/apps/maps/ @elastic/kibana-gis
/x-pack/test/functional/es_archives/maps/ @elastic/kibana-gis
/x-pack/test/visual_regression/tests/maps/index.js @elastic/kibana-gis
/x-pack/plugins/stack_alerts/server/alert_types/geo_containment @elastic/kibana-gis
/x-pack/plugins/stack_alerts/public/alert_types/geo_containment @elastic/kibana-gis
/x-pack/plugins/stack_alerts/server/alert_types/geo_threshold @elastic/kibana-gis
/x-pack/plugins/stack_alerts/public/alert_types/geo_threshold @elastic/kibana-gis
#CC# /src/plugins/maps_legacy/ @elastic/kibana-gis
#CC# /src/plugins/maps_oss/ @elastic/kibana-gis
#CC# /x-pack/plugins/file_upload @elastic/kibana-gis
Expand Down
14 changes: 14 additions & 0 deletions dev_docs/api_welcome.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
id: kibDevDocsApiWelcome
slug: /kibana-dev-docs/api-welcome
title: Welcome
summary: The home of automatically generated plugin API documentation using extracted TSDocs
date: 2021-01-02
tags: ['kibana','dev', 'contributor', 'api docs']
---

Welcome to Kibana's plugin API documentation. As a plugin developer, this is where you can
learn the details of every service you can take advantage of to help you build awe-inspiring creative solutions and applications!

If you have any questions or issues, please reach out to the Kibana platform team or create an issue [here](https://github.com/elastic/kibana/issues).

17 changes: 17 additions & 0 deletions dev_docs/dev_welcome.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
id: kibDevDocsWelcome
slug: /kibana-dev-docs/welcome
title: Welcome
summary: Build custom solutions and applications on top of Kibana.
date: 2021-01-02
tags: ['kibana','dev', 'contributor']
---

Welcome to Kibana's plugin developer documentation!

Did you know that the vast majority of functionality built inside of Kibana is a plugin? A handful of core services hold the system together,
but it's our vast system of plugin developers that provide the amazing, out of the box, functionality you can use when building your own set of
custom utilities and applications.

Browse the `Services` section to view all the plugins that offer functionality you can take advantage of, or check out the
`API documentation` to dig into the nitty gritty details of every public plugin API.
1 change: 1 addition & 0 deletions docs/settings/settings-xkb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ include::logs-ui-settings.asciidoc[]
include::ml-settings.asciidoc[]
include::reporting-settings.asciidoc[]
include::spaces-settings.asciidoc[]
include::task-manager-settings.asciidoc[]
include::i18n-settings.asciidoc[]
include::fleet-settings.asciidoc[]
32 changes: 32 additions & 0 deletions docs/settings/task-manager-settings.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[role="xpack"]
[[task-manager-settings-kb]]
=== Task Manager settings in {kib}
++++
<titleabbrev>Task Manager settings</titleabbrev>
++++

Task Manager runs background tasks by polling for work on an interval. You can configure its behavior to tune for performance and throughput.

[float]
[[task-manager-settings]]
==== Task Manager settings

[cols="2*<"]
|===
| `xpack.task_manager.max_attempts`
| The maximum number of times a task will be attempted before being abandoned as failed. Defaults to 3.

| `xpack.task_manager.poll_interval`
| How often, in milliseconds, the task manager will look for more work. Defaults to 3000 and cannot be lower than 100.

| `xpack.task_manager.request_capacity`
| How many requests can Task Manager buffer before it rejects new requests. Defaults to 1000.

| `xpack.task_manager.index`
| The name of the index used to store task information. Defaults to `.kibana_task_manager`.

| `xpack.task_manager.max_workers`
| The maximum number of tasks that this Kibana instance will run simultaneously. Defaults to 10.


|===
2 changes: 1 addition & 1 deletion docs/setup/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ images:

[horizontal]
`server.name`:: `kibana`
`server.host`:: `"0"`
`server.host`:: `"0.0.0.0"`
`elasticsearch.hosts`:: `http://elasticsearch:9200`
`monitoring.ui.container.elasticsearch.enabled`:: `true`

Expand Down
2 changes: 1 addition & 1 deletion docs/user/alerting/alerting-getting-started.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Alert schedules are defined as an interval between subsequent checks, and can ra

[IMPORTANT]
==============================================
The intervals of alert checks in {kib} are approximate, their timing of their execution is affected by factors such as the frequency at which tasks are claimed and the task load on the system. See <<alerting-scale-performance>> for more information.
The intervals of alert checks in {kib} are approximate, their timing of their execution is affected by factors such as the frequency at which tasks are claimed and the task load on the system. See <<alerting-production-considerations>> for more information.
==============================================

[float]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
[role="xpack"]
[[alerting-scale-performance]]
== Scale and performance
[[alerting-production-considerations]]
== Production considerations

{kib} alerting run both alert checks and actions as persistent background tasks. This has two major benefits:
{kib} alerting run both alert checks and actions as persistent background tasks managed by the Kibana Task Manager. This has two major benefits:

* *Persistence*: all task state and scheduling is stored in {es}, so if {kib} is restarted, alerts and actions will pick up where they left off.
* *Persistence*: all task state and scheduling is stored in {es}, so if {kib} is restarted, alerts and actions will pick up where they left off. Task definitions for alerts and actions are stored in the index specified by `xpack.task_manager.index` (defaults to `.kibana_task_manager`). It is important to have at least 1 replica of this index for production deployments, since if you lose this index all scheduled alerts and actions are also lost.
* *Scaling*: multiple {kib} instances can read from and update the same task queue in {es}, allowing the alerting and action load to be distributed across instances. In cases where a {kib} instance no longer has capacity to run alert checks or actions, capacity can be increased by adding additional {kib} instances.

[float]
=== Running background alert checks and actions

{kib} background tasks are managed by:

* Polling an {es} task index for overdue tasks at 3 second intervals.
* Polling an {es} task index for overdue tasks at 3 second intervals. This interval can be changed using the `xpack.task_manager.poll_interval` setting.
* Tasks are then claiming them by updating them in the {es} index, using optimistic concurrency control to prevent conflicts. Each {kib} instance can run a maximum of 10 concurrent tasks, so a maximum of 10 tasks are claimed each interval.
* Tasks are run on the {kib} server.
* In the case of alerts which are recurring background checks, upon completion the task is scheduled again according to the <<defining-alerts-general-details, check interval>>.

[IMPORTANT]
==============================================
Because tasks are polled at 3 second intervals and only 10 tasks can run concurrently per {kib} instance, it is possible for alert and action tasks to be run late. This can happen if:
Because by default tasks are polled at 3 second intervals and only 10 tasks can run concurrently per {kib} instance, it is possible for alert and action tasks to be run late. This can happen if:
* Alerts use a small *check interval*. The lowest interval possible is 3 seconds, though intervals of 30 seconds or higher are recommended.
* Many alerts or actions must be *run at once*. In this case pending tasks will queue in {es}, and be pulled 10 at a time from the queue at 3 second intervals.
* *Long running tasks* occupy slots for an extended time, leaving fewer slots for other tasks.
For details on the settings that can influence the performance and throughput of Task Manager, see {task-manager-settings}.
==============================================
2 changes: 1 addition & 1 deletion docs/user/alerting/defining-alerts.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ image::images/alert-flyout-general-details.png[alt='All alerts have name, tags,

Name:: The name of the alert. While this name does not have to be unique, the name can be referenced in actions and also appears in the searchable alert listing in the management UI. A distinctive name can help identify and find an alert.
Tags:: A list of tag names that can be applied to an alert. Tags can help you organize and find alerts, because tags appear in the alert listing in the management UI which is searchable by tag.
Check every:: This value determines how frequently the alert conditions below are checked. Note that the timing of background alert checks are not guaranteed, particularly for intervals of less than 10 seconds. See <<alerting-scale-performance>> for more information.
Check every:: This value determines how frequently the alert conditions below are checked. Note that the timing of background alert checks are not guaranteed, particularly for intervals of less than 10 seconds. See <<alerting-production-considerations>> for more information.
Notify every:: This value limits how often actions are repeated when an alert instance remains active across alert checks. See <<alerting-concepts-suppressing-duplicate-notifications>> for more information.

[float]
Expand Down
2 changes: 1 addition & 1 deletion docs/user/alerting/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ include::alerting-getting-started.asciidoc[]
include::defining-alerts.asciidoc[]
include::action-types.asciidoc[]
include::alert-types.asciidoc[]
include::alerting-scale-performance.asciidoc[]
include::alerting-production-considerations.asciidoc[]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
"proper-lockfile": "^3.2.0",
"proxy-from-env": "1.0.0",
"puid": "1.0.7",
"puppeteer": "^5.5.0",
"puppeteer": "npm:@elastic/[email protected]",
"query-string": "^6.13.2",
"raw-loader": "^3.1.0",
"re2": "^1.15.4",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 0 additions & 9 deletions src/core/server/core_app/assets/favicons/browserconfig.xml

This file was deleted.

Binary file not shown.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/core/server/core_app/assets/favicons/favicon.ico
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.
4 changes: 4 additions & 0 deletions src/core/server/core_app/assets/favicons/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 0 additions & 19 deletions src/core/server/core_app/assets/favicons/manifest.json

This file was deleted.

Binary file not shown.
34 changes: 0 additions & 34 deletions src/core/server/core_app/assets/favicons/safari-pinned-tab.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ describe('Platform assets', function () {
});

it('exposes static assets', async () => {
await kbnTestServer.request.get(root, '/ui/favicons/favicon.ico').expect(200);
await kbnTestServer.request.get(root, '/ui/favicons/favicon.svg').expect(200);
});

it('returns 404 if not found', async function () {
await kbnTestServer.request.get(root, '/ui/favicons/not-a-favicon.ico').expect(404);
await kbnTestServer.request.get(root, '/ui/favicons/not-a-favicon.svg').expect(404);
});

it('does not expose folder content', async function () {
Expand Down
9 changes: 9 additions & 0 deletions src/core/server/http/__snapshots__/http_config.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions src/core/server/http/http_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { config, HttpConfig } from './http_config';
import { CspConfig } from '../csp';
import { ExternalUrlConfig } from '../external_url';

const validHostnames = ['www.example.com', '8.8.8.8', '::1', 'localhost'];
const invalidHostname = 'asdf$%^';
const validHostnames = ['www.example.com', '8.8.8.8', '::1', 'localhost', '0.0.0.0'];
const invalidHostnames = ['asdf$%^', '0'];

jest.mock('os', () => {
const original = jest.requireActual('os');
Expand All @@ -48,11 +48,10 @@ test('accepts valid hostnames', () => {
});

test('throws if invalid hostname', () => {
const httpSchema = config.schema;
const obj = {
host: invalidHostname,
};
expect(() => httpSchema.validate(obj)).toThrowErrorMatchingSnapshot();
for (const host of invalidHostnames) {
const httpSchema = config.schema;
expect(() => httpSchema.validate({ host })).toThrowErrorMatchingSnapshot();
}
});

describe('requestId', () => {
Expand Down Expand Up @@ -304,17 +303,17 @@ describe('with compression', () => {

test('throws if invalid referrer whitelist', () => {
const httpSchema = config.schema;
const invalidHostnames = {
const nonEmptyArray = {
compression: {
referrerWhitelist: [invalidHostname],
referrerWhitelist: invalidHostnames,
},
};
const emptyArray = {
compression: {
referrerWhitelist: [],
},
};
expect(() => httpSchema.validate(invalidHostnames)).toThrowErrorMatchingSnapshot();
expect(() => httpSchema.validate(nonEmptyArray)).toThrowErrorMatchingSnapshot();
expect(() => httpSchema.validate(emptyArray)).toThrowErrorMatchingSnapshot();
});

Expand Down
13 changes: 6 additions & 7 deletions src/core/server/http/http_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export const config = {
host: schema.string({
defaultValue: 'localhost',
hostname: true,
validate(value) {
if (value === '0') {
return 'value 0 is not a valid hostname (use "0.0.0.0" to bind to all interfaces)';
}
},
}),
maxPayload: schema.byteSize({
defaultValue: '1048576b',
Expand Down Expand Up @@ -195,13 +200,7 @@ export class HttpConfig {
rawExternalUrlConfig: ExternalUrlConfig
) {
this.autoListen = rawHttpConfig.autoListen;
// TODO: Consider dropping support for '0' in v8.0.0. This value is passed
// to hapi, which validates it. Prior to hapi v20, '0' was considered a
// valid host, however the validation logic internally in hapi was
// re-written for v20 and hapi no longer considers '0' a valid host. For
// details, see:
// https://github.com/elastic/kibana/issues/86716#issuecomment-749623781
this.host = rawHttpConfig.host === '0' ? '0.0.0.0' : rawHttpConfig.host;
this.host = rawHttpConfig.host;
this.port = rawHttpConfig.port;
this.cors = rawHttpConfig.cors;
this.customResponseHeaders = Object.entries(rawHttpConfig.customResponseHeaders ?? {}).reduce(
Expand Down
Loading

0 comments on commit 92d0b90

Please sign in to comment.