Skip to content

Commit

Permalink
Merge branch 'master' into uptime_remove-legacy-es-client
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Dec 17, 2019
2 parents c745fb8 + 74e1d17 commit 75e9d84
Show file tree
Hide file tree
Showing 139 changed files with 2,005 additions and 861 deletions.
10 changes: 10 additions & 0 deletions docs/apm/settings.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Do not link directly to this page.
// Link to the anchor in `/docs/settings/apm-settings.asciidoc` instead.
[[apm-settings-in-kibana]]
=== APM settings in Kibana

You do not need to configure any settings to use APM. It is enabled by default.
If you'd like to change any of the default values,
copy and paste the relevant settings below into your `kibana.yml` configuration file.

include::./../settings/apm-settings.asciidoc[tag=general-apm-settings]
23 changes: 14 additions & 9 deletions docs/apm/using-the-apm-ui.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ Not to worry, we've created this guide to help you get the most out of Elastic A

APM is available via the navigation sidebar in {Kib}.

* <<filters,Filters>>
* <<services,Services overview>>
* <<traces,Traces overview>>
* <<transactions,Transaction overview>>
* <<spans,Span timeline visualization>>
* <<errors,Debug errors>>
* <<metrics,Metrics overview>>
* <<machine-learning-integration,Machine learning integration>>
* <<query-bar,Advanced queries>>
* <<filters>>
* <<services>>
* <<traces>>
* <<transactions>>
* <<spans>>
* <<errors>>
* <<metrics>>
* <<machine-learning-integration>>
* <<agent-configuration>>
* <<advanced-queries>>
* <<apm-settings-in-kibana>>
* <<troubleshooting>>

include::filters.asciidoc[]

Expand All @@ -36,4 +39,6 @@ include::agent-configuration.asciidoc[]

include::advanced-queries.asciidoc[]

include::settings.asciidoc[]

include::troubleshooting.asciidoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export interface CoreSetup
| [http](./kibana-plugin-server.coresetup.http.md) | <code>HttpServiceSetup</code> | [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md) |
| [savedObjects](./kibana-plugin-server.coresetup.savedobjects.md) | <code>SavedObjectsServiceSetup</code> | [SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md) |
| [uiSettings](./kibana-plugin-server.coresetup.uisettings.md) | <code>UiSettingsServiceSetup</code> | [UiSettingsServiceSetup](./kibana-plugin-server.uisettingsservicesetup.md) |
| [uuid](./kibana-plugin-server.coresetup.uuid.md) | <code>UuidServiceSetup</code> | [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [CoreSetup](./kibana-plugin-server.coresetup.md) &gt; [uuid](./kibana-plugin-server.coresetup.uuid.md)

## CoreSetup.uuid property

[UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md)

<b>Signature:</b>

```typescript
uuid: UuidServiceSetup;
```
1 change: 1 addition & 0 deletions docs/development/core/server/kibana-plugin-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [UiSettingsParams](./kibana-plugin-server.uisettingsparams.md) | UiSettings parameters defined by the plugins. |
| [UiSettingsServiceSetup](./kibana-plugin-server.uisettingsservicesetup.md) | |
| [UserProvidedValues](./kibana-plugin-server.userprovidedvalues.md) | Describes the values explicitly set by user. |
| [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) | APIs to access the application's instance uuid. |

## Variables

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) &gt; [getInstanceUuid](./kibana-plugin-server.uuidservicesetup.getinstanceuuid.md)

## UuidServiceSetup.getInstanceUuid() method

Retrieve the Kibana instance uuid.

<b>Signature:</b>

```typescript
getInstanceUuid(): string;
```
<b>Returns:</b>

`string`

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md)

## UuidServiceSetup interface

APIs to access the application's instance uuid.

<b>Signature:</b>

```typescript
export interface UuidServiceSetup
```

## Methods

| Method | Description |
| --- | --- |
| [getInstanceUuid()](./kibana-plugin-server.uuidservicesetup.getinstanceuuid.md) | Retrieve the Kibana instance uuid. |

5 changes: 5 additions & 0 deletions docs/settings/apm-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ copy and paste the relevant settings below into your `kibana.yml` configuration
[[general-apm-settings-kb]]
==== General APM settings

// This content is reused in the APM app documentation.
// Any changes made in this file will be seen there as well.
// tag::general-apm-settings[]

xpack.apm.enabled:: Set to `false` to disabled the APM plugin {kib}. Defaults to
`true`.

Expand All @@ -37,3 +41,4 @@ apm_oss.metricsIndices:: Matcher for indices containing metric documents. Defaul

apm_oss.sourcemapIndices:: Matcher for indices containing sourcemap documents. Defaults to `apm-*`.

// end::general-apm-settings[]
8 changes: 6 additions & 2 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ that feature would not take any effect.

`logging.rotate.everyBytes:`:: [experimental] *Default: 10485760* The maximum size of a log file (that is `not an exact` limit). After the
limit is reached, a new log file is generated. The default size limit is 10485760 (10 MB) and
this option should be at least greater than 1024.
this option should be in the range of 102400 (100KB) to 1073741824 (1GB).

`logging.rotate.keepFiles:`:: [experimental] *Default: 7* The number of most recent rotated log files to keep
on disk. Older files are deleted during log rotation. The default value is 7. The `logging.rotate.keepFiles`
Expand Down Expand Up @@ -390,12 +390,16 @@ Rollup user interface.

`i18n.locale`:: *Default: en* Set this value to change the Kibana interface language. Valid locales are: `en`, `zh-CN`, `ja-JP`.

`xpack.actions.enabledActionTypes:`:: *Default: +[ {asterisk} ]+* Set this value
to an array of action types that are enabled. An element of `*` indicates all
action types registered are enabled. The action types provided by Kibana are:
`.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, `.webhook`.

`xpack.actions.whitelistedHosts:`:: *Default: +[ {asterisk} ]+* Set this value
to an array of host names which actions such as email, slack, pagerduty, and
webhook can connect to. An element of `*` indicates any host can be connected
to. An empty array indicates no hosts can be connected to.


include::{docdir}/settings/apm-settings.asciidoc[]
include::{docdir}/settings/dev-settings.asciidoc[]
include::{docdir}/settings/graph-settings.asciidoc[]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"hapi": "^17.5.3",
"hapi-auth-cookie": "^9.0.0",
"history": "^4.9.0",
"hjson": "3.2.0",
"hjson": "3.2.1",
"hoek": "^5.0.4",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.2",
Expand Down
9 changes: 9 additions & 0 deletions src/core/server/http/http_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/

import uuid from 'uuid';
import { config, HttpConfig } from '.';
import { Env } from '../config';
import { getEnvOptions } from '../config/__mocks__/env';
Expand Down Expand Up @@ -77,6 +78,14 @@ test('throws if basepath is not specified, but rewriteBasePath is set', () => {
expect(() => httpSchema.validate(obj)).toThrowErrorMatchingSnapshot();
});

test('accepts only valid uuids for server.uuid', () => {
const httpSchema = config.schema;
expect(() => httpSchema.validate({ uuid: uuid.v4() })).not.toThrow();
expect(() => httpSchema.validate({ uuid: 'not an uuid' })).toThrowErrorMatchingInlineSnapshot(
`"[uuid]: must be a valid uuid"`
);
});

describe('with TLS', () => {
test('throws if TLS is enabled but `key` is not specified', () => {
const httpSchema = config.schema;
Expand Down
6 changes: 6 additions & 0 deletions src/core/server/http/http_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { CspConfigType, CspConfig, ICspConfig } from '../csp';
import { SslConfig, sslSchema } from './ssl_config';

const validBasePathRegex = /(^$|^\/.*[^\/]$)/;
const uuidRegexp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

const match = (regex: RegExp, errorMsg: string) => (str: string) =>
regex.test(str) ? undefined : errorMsg;
Expand Down Expand Up @@ -92,6 +93,11 @@ export const config = {
)
),
}),
uuid: schema.maybe(
schema.string({
validate: match(uuidRegexp, 'must be a valid uuid'),
})
),
},
{
validate: rawConfig => {
Expand Down
4 changes: 4 additions & 0 deletions src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { IUiSettingsClient, UiSettingsServiceSetup } from './ui_settings';
import { SavedObjectsClientContract } from './saved_objects/types';
import { SavedObjectsServiceSetup, SavedObjectsServiceStart } from './saved_objects';
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
import { UuidServiceSetup } from './uuid';

export { bootstrap } from './bootstrap';
export { Capabilities, CapabilitiesProvider, CapabilitiesSwitcher } from './capabilities';
Expand Down Expand Up @@ -269,6 +270,8 @@ export interface CoreSetup {
savedObjects: SavedObjectsServiceSetup;
/** {@link UiSettingsServiceSetup} */
uiSettings: UiSettingsServiceSetup;
/** {@link UuidServiceSetup} */
uuid: UuidServiceSetup;
}

/**
Expand All @@ -290,4 +293,5 @@ export {
PluginsServiceSetup,
PluginsServiceStart,
PluginOpaqueId,
UuidServiceSetup,
};
2 changes: 2 additions & 0 deletions src/core/server/internal_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
InternalSavedObjectsServiceSetup,
} from './saved_objects';
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
import { UuidServiceSetup } from './uuid';

/** @internal */
export interface InternalCoreSetup {
Expand All @@ -35,6 +36,7 @@ export interface InternalCoreSetup {
elasticsearch: InternalElasticsearchServiceSetup;
uiSettings: InternalUiSettingsServiceSetup;
savedObjects: InternalSavedObjectsServiceSetup;
uuid: UuidServiceSetup;
}

/**
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class LegacyObjectToConfigAdapter extends ObjectToConfigAdapter {
keepaliveTimeout: configValue.keepaliveTimeout,
socketTimeout: configValue.socketTimeout,
compression: configValue.compression,
uuid: configValue.uuid,
};
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/server/legacy/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
export interface LegacyConfig {
get<T>(key?: string): T;
has(key: string): boolean;
set(key: string, value: any): void;
set(config: Record<string, any>): void;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,23 @@
* under the License.
*/

import { SavedObject } from 'ui/saved_objects/types';
import { SearchSourceContract } from '../../../../../ui/public/courier';
import { esFilters, Query, RefreshInterval } from '../../../../../../plugins/data/public';
import { LegacyServiceDiscoverPlugins } from './legacy_service';

export interface SavedObjectDashboard extends SavedObject {
id?: string;
copyOnSave: boolean;
timeRestore: boolean;
timeTo?: string;
timeFrom?: string;
title: string;
description?: string;
panelsJSON: string;
optionsJSON?: string;
// TODO: write a migration to rid of this, it's only around for bwc.
uiStateJSON?: string;
lastSavedTitle: string;
searchSource: SearchSourceContract;
destroy: () => void;
refreshInterval?: RefreshInterval;
getQuery(): Query;
getFilters(): esFilters.Filter[];
}
const createDiscoverMock = () => {
const setupContract: DeeplyMockedKeys<LegacyServiceDiscoverPlugins> = {
pluginSpecs: [],
disabledPluginSpecs: [],
uiExports: {} as any,
settings: {},
pluginExtendedConfig: {
get: jest.fn(),
has: jest.fn(),
set: jest.fn(),
} as any,
};
return setupContract;
};

export const legacyServiceMock = {
createDiscover: createDiscoverMock,
};
34 changes: 34 additions & 0 deletions src/core/server/legacy/legacy_service.test.mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export const findLegacyPluginSpecsMock = jest
.fn()
.mockImplementation((settings: Record<string, any>) => ({
pluginSpecs: [],
pluginExtendedConfig: {
has: jest.fn(),
get: jest.fn(() => settings),
set: jest.fn(),
},
disabledPluginSpecs: [],
uiExports: [],
}));
jest.doMock('./plugins/find_legacy_plugin_specs.ts', () => ({
findLegacyPluginSpecs: findLegacyPluginSpecsMock,
}));
Loading

0 comments on commit 75e9d84

Please sign in to comment.