Skip to content

Commit

Permalink
Merge branch 'master' into make-actions-exportable
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley14 authored Oct 19, 2021
2 parents 701c96e + f8041e6 commit cbee0f9
Show file tree
Hide file tree
Showing 220 changed files with 4,116 additions and 1,877 deletions.
9 changes: 9 additions & 0 deletions docs/dev-tools/console/console.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,12 @@ image::dev-tools/console/images/console-settings.png["Console Settings", width=6

For a list of available keyboard
shortcuts, click *Help*.

[float]
[[console-settings]]
=== Disable Console

If you don’t want to use *Console*, you can disable it by setting `console.ui.enabled`
to `false` in your `kibana.yml` configuration file. Changing this setting
causes the server to regenerate assets on the next startup,
which might cause a delay before pages start being served.
34 changes: 34 additions & 0 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ configuration using `${MY_ENV_VAR}` syntax.
[cols="2*<"]
|===

| `console.ui.enabled:`
Toggling this causes the server to regenerate assets on the next startup,
which may cause a delay before pages start being served.
Set to `false` to disable Console. *Default: `true`*

| `csp.rules:`
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
A https://w3c.github.io/webappsec-csp/[Content Security Policy] template
Expand Down Expand Up @@ -681,6 +686,10 @@ out through *Advanced Settings*. *Default: `true`*
| Set this value to true to allow Vega to use any URL to access external data
sources and images. When false, Vega can only get data from {es}. *Default: `false`*

| `xpack.ccr.ui.enabled`
Set this value to false to disable the Cross-Cluster Replication UI.
*Default: `true`*

|[[settings-explore-data-in-context]] `xpack.discoverEnhanced.actions.`
`exploreDataInContextMenu.enabled`
| Enables the *Explore underlying data* option that allows you to open *Discover* from a dashboard panel and view the panel data. *Default: `false`*
Expand All @@ -689,6 +698,31 @@ sources and images. When false, Vega can only get data from {es}. *Default: `fal
`exploreDataInChart.enabled`
| Enables you to view the underlying documents in a data series from a dashboard panel. *Default: `false`*

| `xpack.ilm.ui.enabled`
Set this value to false to disable the Index Lifecycle Policies UI.
*Default: `true`*

| `xpack.index_management.ui.enabled`
Set this value to false to disable the Index Management UI.
*Default: `true`*

| `xpack.license_management.ui.enabled`
Set this value to false to disable the License Management UI.
*Default: `true`*

| `xpack.remote_clusters.ui.enabled`
Set this value to false to disable the Remote Clusters UI.
*Default: `true`*

| `xpack.rollup.ui.enabled:`
Set this value to false to disable the Rollup Jobs UI. *Default: true*

| `xpack.snapshot_restore.ui.enabled:`
Set this value to false to disable the Snapshot and Restore UI. *Default: true*

| `xpack.upgrade_assistant.ui.enabled:`
Set this value to false to disable the Upgrade Assistant UI. *Default: true*

| `i18n.locale` {ess-icon}
| Set this value to change the {kib} interface language.
Valid locales are: `en`, `zh-CN`, `ja-JP`. *Default: `en`*
Expand Down
93 changes: 93 additions & 0 deletions packages/elastic-apm-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# @elastic/apm-generator

`@elastic/apm-generator` is an experimental tool to generate synthetic APM data. It is intended to be used for development and testing of the Elastic APM app in Kibana.

At a high-level, the module works by modeling APM events/metricsets with [a fluent API](https://en.wikipedia.org/wiki/Fluent_interface). The models can then be serialized and converted to Elasticsearch documents. In the future we might support APM Server as an output as well.

## Usage

This section assumes that you've installed Kibana's dependencies by running `yarn kbn bootstrap` in the repository's root folder.

This library can currently be used in two ways:

- Imported as a Node.js module, for instance to be used in Kibana's functional test suite.
- With a command line interface, to index data based on some example scenarios.

### Using the Node.js module

#### Concepts

- `Service`: a logical grouping for a monitored service. A `Service` object contains fields like `service.name`, `service.environment` and `agent.name`.
- `Instance`: a single instance of a monitored service. E.g., the workload for a monitored service might be spread across multiple containers. An `Instance` object contains fields like `service.node.name` and `container.id`.
- `Timerange`: an object that will return an array of timestamps based on an interval and a rate. These timestamps can be used to generate events/metricsets.
- `Transaction`, `Span`, `APMError` and `Metricset`: events/metricsets that occur on an instance. For more background, see the [explanation of the APM data model](https://www.elastic.co/guide/en/apm/get-started/7.15/apm-data-model.html)


#### Example

```ts
import { service, timerange, toElasticsearchOutput } from '@elastic/apm-generator';

const instance = service('synth-go', 'production', 'go')
.instance('instance-a');

const from = new Date('2021-01-01T12:00:00.000Z').getTime();
const to = new Date('2021-01-01T12:00:00.000Z').getTime() - 1;

const traceEvents = timerange(from, to)
.interval('1m')
.rate(10)
.flatMap(timestamp => instance.transaction('GET /api/product/list')
.timestamp(timestamp)
.duration(1000)
.success()
.children(
instance.span('GET apm-*/_search', 'db', 'elasticsearch')
.timestamp(timestamp + 50)
.duration(900)
.destination('elasticsearch')
.success()
).serialize()
);

const metricsets = timerange(from, to)
.interval('30s')
.rate(1)
.flatMap(timestamp => instance.appMetrics({
'system.memory.actual.free': 800,
'system.memory.total': 1000,
'system.cpu.total.norm.pct': 0.6,
'system.process.cpu.total.norm.pct': 0.7,
}).timestamp(timestamp)
.serialize()
);

const esEvents = toElasticsearchOutput(traceEvents.concat(metricsets));
```

#### Generating metricsets

`@elastic/apm-generator` can also automatically generate transaction metrics, span destination metrics and transaction breakdown metrics based on the generated trace events. If we expand on the previous example:

```ts
import { getTransactionMetrics, getSpanDestinationMetrics, getBreakdownMetrics } from '@elastic/apm-generator';

const esEvents = toElasticsearchOutput([
...traceEvents,
...getTransactionMetrics(traceEvents),
...getSpanDestinationMetrics(traceEvents),
...getBreakdownMetrics(traceEvents)
]);
```

### CLI

Via the CLI, you can upload examples. The supported examples are listed in `src/lib/es.ts`. A `--target` option that specifies the Elasticsearch URL should be defined when running the `example` command. Here's an example:

`$ node packages/elastic-apm-generator/src/scripts/es.js example simple-trace --target=http://admin:changeme@localhost:9200`

The following options are supported:
- `to`: the end of the time range, in ISO format. By default, the current time will be used.
- `from`: the start of the time range, in ISO format. By default, `to` minus 15 minutes will be used.
- `apm-server-version`: the version used in the index names bootstrapped by APM Server, e.g. `7.16.0`. __If these indices do not exist, the script will exit with an error. It will not bootstrap the indices itself.__

2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/collapsible_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export function CollapsibleNav({
iconType="plusInCircleFilled"
>
{i18n.translate('core.ui.primaryNav.addData', {
defaultMessage: 'Add data',
defaultMessage: 'Add integrations',
})}
</EuiButton>
</EuiCollapsibleNavGroup>
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/console/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
*/

import './index.scss';
import { PluginInitializerContext } from 'src/core/public';

import { ConsoleUIPlugin } from './plugin';

export type { ConsoleUILocatorParams } from './plugin';
export type { ConsoleUILocatorParams, ConsolePluginSetup } from './types';

export { ConsoleUIPlugin as Plugin };

export function plugin() {
return new ConsoleUIPlugin();
export function plugin(ctx: PluginInitializerContext) {
return new ConsoleUIPlugin(ctx);
}
122 changes: 66 additions & 56 deletions src/plugins/console/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,87 @@
*/

import { i18n } from '@kbn/i18n';
import { SerializableRecord } from '@kbn/utility-types';
import { Plugin, CoreSetup } from 'src/core/public';
import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/public';

import { FeatureCatalogueCategory } from '../../home/public';
import { AppSetupUIPluginDependencies } from './types';

export interface ConsoleUILocatorParams extends SerializableRecord {
loadFrom?: string;
}
import {
AppSetupUIPluginDependencies,
ClientConfigType,
ConsolePluginSetup,
ConsoleUILocatorParams,
} from './types';

export class ConsoleUIPlugin implements Plugin<void, void, AppSetupUIPluginDependencies> {
constructor(private ctx: PluginInitializerContext) {}

public setup(
{ notifications, getStartServices, http }: CoreSetup,
{ devTools, home, share, usageCollection }: AppSetupUIPluginDependencies
) {
if (home) {
home.featureCatalogue.register({
): ConsolePluginSetup {
const {
ui: { enabled: isConsoleUiEnabled },
} = this.ctx.config.get<ClientConfigType>();

if (isConsoleUiEnabled) {
if (home) {
home.featureCatalogue.register({
id: 'console',
title: i18n.translate('console.devToolsTitle', {
defaultMessage: 'Interact with the Elasticsearch API',
}),
description: i18n.translate('console.devToolsDescription', {
defaultMessage: 'Skip cURL and use a JSON interface to work with your data in Console.',
}),
icon: 'consoleApp',
path: '/app/dev_tools#/console',
showOnHomePage: false,
category: FeatureCatalogueCategory.ADMIN,
});
}

devTools.register({
id: 'console',
title: i18n.translate('console.devToolsTitle', {
defaultMessage: 'Interact with the Elasticsearch API',
}),
description: i18n.translate('console.devToolsDescription', {
defaultMessage: 'Skip cURL and use a JSON interface to work with your data in Console.',
order: 1,
title: i18n.translate('console.consoleDisplayName', {
defaultMessage: 'Console',
}),
icon: 'consoleApp',
path: '/app/dev_tools#/console',
showOnHomePage: false,
category: FeatureCatalogueCategory.ADMIN,
});
}
enableRouting: false,
mount: async ({ element }) => {
const [core] = await getStartServices();

devTools.register({
id: 'console',
order: 1,
title: i18n.translate('console.consoleDisplayName', {
defaultMessage: 'Console',
}),
enableRouting: false,
mount: async ({ element }) => {
const [core] = await getStartServices();
const {
i18n: { Context: I18nContext },
docLinks: { DOC_LINK_VERSION },
} = core;

const {
i18n: { Context: I18nContext },
docLinks: { DOC_LINK_VERSION },
} = core;
const { renderApp } = await import('./application');

const { renderApp } = await import('./application');
return renderApp({
http,
docLinkVersion: DOC_LINK_VERSION,
I18nContext,
notifications,
usageCollection,
element,
});
},
});

return renderApp({
http,
docLinkVersion: DOC_LINK_VERSION,
I18nContext,
notifications,
usageCollection,
element,
});
},
});
const locator = share.url.locators.create<ConsoleUILocatorParams>({
id: 'CONSOLE_APP_LOCATOR',
getLocation: async ({ loadFrom }) => {
return {
app: 'dev_tools',
path: `#/console${loadFrom ? `?load_from=${loadFrom}` : ''}`,
state: { loadFrom },
};
},
});

const locator = share.url.locators.create<ConsoleUILocatorParams>({
id: 'CONSOLE_APP_LOCATOR',
getLocation: async ({ loadFrom }) => {
return {
app: 'dev_tools',
path: `#/console${loadFrom ? `?load_from=${loadFrom}` : ''}`,
state: { loadFrom },
};
},
});
return { locator };
}

return { locator };
return {};
}

public start() {}
Expand Down
13 changes: 13 additions & 0 deletions src/plugins/console/public/types/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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.
*/

export interface ClientConfigType {
ui: {
enabled: boolean;
};
}
2 changes: 2 additions & 0 deletions src/plugins/console/public/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export * from './core_editor';
export * from './token';
export * from './tokens_provider';
export * from './common';
export { ClientConfigType } from './config';
export { ConsoleUILocatorParams } from './locator';
12 changes: 12 additions & 0 deletions src/plugins/console/public/types/locator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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 { SerializableRecord } from '@kbn/utility-types';

export interface ConsoleUILocatorParams extends SerializableRecord {
loadFrom?: string;
}
8 changes: 7 additions & 1 deletion src/plugins/console/public/types/plugin_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
import { HomePublicPluginSetup } from '../../../home/public';
import { DevToolsSetup } from '../../../dev_tools/public';
import { UsageCollectionSetup } from '../../../usage_collection/public';
import { SharePluginSetup } from '../../../share/public';
import { SharePluginSetup, LocatorPublic } from '../../../share/public';

import { ConsoleUILocatorParams } from './locator';

export interface AppSetupUIPluginDependencies {
home?: HomePublicPluginSetup;
devTools: DevToolsSetup;
share: SharePluginSetup;
usageCollection?: UsageCollectionSetup;
}

export interface ConsolePluginSetup {
locator?: LocatorPublic<ConsoleUILocatorParams>;
}
Loading

0 comments on commit cbee0f9

Please sign in to comment.