Skip to content

Commit

Permalink
Merge branch 'master' into fix-agent-metrics-link
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored May 15, 2020
2 parents 46b625b + 07e57fb commit b590f8b
Show file tree
Hide file tree
Showing 91 changed files with 1,479 additions and 739 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module.exports = {
* Licence headers
*/
{
files: ['**/*.{js,ts,tsx}'],
files: ['**/*.{js,ts,tsx}', '!plugins/**/*'],
rules: {
'@kbn/eslint/require-license-header': [
'error',
Expand Down
Binary file modified docs/apm/images/apm-agent-configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/apm-alert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/apm-errors-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/apm-query-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/apm-services-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/apm/images/apm-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/apm-setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/apm-traces.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/apm-transaction-response-dist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/apm-transactions-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/apm/images/jvm-metrics-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apm/images/jvm-metrics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions docs/apm/metrics.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ For example, you might be able to correlate a high number of errors with a long
[role="screenshot"]
image::apm/images/apm-metrics.png[Example view of the Metrics overview in APM app in Kibana]

If you're using the Java Agent, the metrics view focuses on JVMs.
A detailed view of metrics per JVM makes it much easier to analyze the provided metrics:
If you're using the Java Agent, you can view metrics for each JVM.

[role="screenshot"]
image::apm/images/jvm-metrics-overview.png[Example view of the Metrics overview for the Java Agent]

Breaking down metrics by JVM makes it much easier to analyze the provided metrics:
CPU usage, memory usage, heap or non-heap memory,
thread count, garbage collection rate, and garbage collection time spent per minute.

Expand Down
18 changes: 12 additions & 6 deletions docs/settings/reporting-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,22 @@ control the capturing process.
[cols="2*<"]
|===
| `xpack.reporting.capture.timeouts.openUrl`
| How long to allow the Reporting browser to wait for the initial data of the
{kib} page to load. Defaults to `30000` (30 seconds).
| Specify how long to allow the Reporting browser to wait for the "Loading..." screen
to dismiss and find the initial data for the Kibana page. If the time is
exceeded, a page screenshot is captured showing the current state, and the download link shows a warning message.
Defaults to `30000` (30 seconds).

| `xpack.reporting.capture.timeouts.waitForElements`
| How long to allow the Reporting browser to wait for the visualization panels to
load on the {kib} page. Defaults to `30000` (30 seconds).
| Specify how long to allow the Reporting browser to wait for all visualization
panels to load on the Kibana page. If the time is exceeded, a page screenshot
is captured showing the current state, and the download link shows a warning message. Defaults to `30000` (30
seconds).

| `xpack.reporting.capture.timeouts.renderComplete`
| How long to allow the Reporting browser to wait for each visualization to
signal that it is done renderings. Defaults to `30000` (30 seconds).
| Specify how long to allow the Reporting browser to wait for all visualizations to
fetch and render the data. If the time is exceeded, a
page screenshot is captured showing the current state, and the download link shows a warning message. Defaults to
`30000` (30 seconds).

|===

Expand Down
67 changes: 33 additions & 34 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ If you configure a custom index, the name must be lowercase, and conform to the
{es} {ref}/indices-create-index.html[index name limitations].
*Default: `".kibana"`*

| `kibana.autocompleteTimeout:`
| `kibana.autocompleteTimeout:` {ess-icon}
| Time in milliseconds to wait for autocomplete suggestions from {es}.
This value must be a whole number greater than zero. *Default: `"1000"`*

| `kibana.autocompleteTerminateAfter:`
| `kibana.autocompleteTerminateAfter:` {ess-icon}
| Maximum number of documents loaded by each shard to generate autocomplete
suggestions. This value must be a whole number greater than zero.
*Default: `"100000"`*
Expand Down Expand Up @@ -300,11 +300,11 @@ suppress all logging output. *Default: `false`*
(for example, `America/Los_Angeles`) to log events using that timezone. For a
list of timezones, refer to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. *Default: `UTC`*

| [[logging-verbose]] `logging.verbose:`
| [[logging-verbose]] `logging.verbose:` {ece-icon}
| Set to `true` to log all events, including system usage information and all
requests. Supported on {ece}. *Default: `false`*
requests. *Default: `false`*

| `map.includeElasticMapsService:`
| `map.includeElasticMapsService:` {ess-icon}
| Set to `false` to disable connections to Elastic Maps Service.
When `includeElasticMapsService` is turned off, only the vector layers configured by `map.regionmap`
and the tile layer configured by `map.tilemap.url` are available in <<maps, Maps>>. *Default: `true`*
Expand All @@ -313,9 +313,9 @@ and the tile layer configured by `map.tilemap.url` are available in <<maps, Maps
| Set to `true` to proxy all <<maps, Maps application>> Elastic Maps Service
requests through the {kib} server. *Default: `false`*

| [[regionmap-settings]] `map.regionmap:`
| [[regionmap-settings]] `map.regionmap:` {ess-icon} {ece-icon}
| Specifies additional vector layers for
use in <<maps, Maps>> visualizations. Supported on {ece}. Each layer
use in <<maps, Maps>> visualizations. Each layer
object points to an external vector file that contains a geojson
FeatureCollection. The file must use the
https://en.wikipedia.org/wiki/World_Geodetic_System[WGS84 coordinate reference system (ESPG:4326)]
Expand Down Expand Up @@ -343,20 +343,19 @@ map.regionmap:
[cols="2*<"]
|===

| [[regionmap-ES-map]] `map.includeElasticMapsService:`
| [[regionmap-ES-map]] `map.includeElasticMapsService:` {ece-icon}
| Turns on or off whether layers from the Elastic Maps Service should be included in the vector
layer option list. Supported on {ece}. By turning this off,
layer option list. By turning this off,
only the layers that are configured here will be included. The default is `true`.
This also affects whether tile-service from the Elastic Maps Service will be available.

| [[regionmap-attribution]] `map.regionmap.layers[].attribution:`
| [[regionmap-attribution]] `map.regionmap.layers[].attribution:` {ess-icon} {ece-icon}
| Optional. References the originating source of the geojson file.
Supported on {ece}.

| [[regionmap-fields]] `map.regionmap.layers[].fields[]:`
| [[regionmap-fields]] `map.regionmap.layers[].fields[]:` {ess-icon} {ece-icon}
| Mandatory. Each layer
can contain multiple fields to indicate what properties from the geojson
features you wish to expose. Supported on {ece}. The following shows how to define multiple
features you wish to expose. The following shows how to define multiple
properties:

|===
Expand All @@ -379,44 +378,44 @@ map.regionmap:
[cols="2*<"]
|===

| [[regionmap-field-description]] `map.regionmap.layers[].fields[].description:`
| [[regionmap-field-description]] `map.regionmap.layers[].fields[].description:` {ess-icon} {ece-icon}
| Mandatory. The human readable text that is shown under the Options tab when
building the Region Map visualization. Supported on {ece}.
building the Region Map visualization.

| [[regionmap-field-name]] `map.regionmap.layers[].fields[].name:`
| [[regionmap-field-name]] `map.regionmap.layers[].fields[].name:` {ess-icon} {ece-icon}
| Mandatory.
This value is used to do an inner-join between the document stored in
{es} and the geojson file. For example, if the field in the geojson is
called `Location` and has city names, there must be a field in {es}
that holds the same values that {kib} can then use to lookup for the geoshape
data. Supported on {ece}.
data.

| [[regionmap-name]] `map.regionmap.layers[].name:`
| [[regionmap-name]] `map.regionmap.layers[].name:` {ess-icon} {ece-icon}
| Mandatory. A description of
the map being provided. Supported on {ece}.
the map being provided.

| [[regionmap-url]] `map.regionmap.layers[].url:`
| [[regionmap-url]] `map.regionmap.layers[].url:` {ess-icon} {ece-icon}
| Mandatory. The location of the
geojson file as provided by a webserver. Supported on {ece}.
geojson file as provided by a webserver.

| [[tilemap-settings]] `map.tilemap.options.attribution:`
| The map attribution string. Supported on {ece}.
| [[tilemap-settings]] `map.tilemap.options.attribution:` {ess-icon} {ece-icon}
| The map attribution string.
*Default: `"© [Elastic Maps Service](https://www.elastic.co/elastic-maps-service)"`*

| [[tilemap-max-zoom]] `map.tilemap.options.maxZoom:`
| The maximum zoom level. Supported on {ece}. *Default: `10`*
| [[tilemap-max-zoom]] `map.tilemap.options.maxZoom:` {ess-icon} {ece-icon}
| The maximum zoom level. *Default: `10`*

| [[tilemap-min-zoom]] `map.tilemap.options.minZoom:`
| The minimum zoom level. Supported on {ece}. *Default: `1`*
| [[tilemap-min-zoom]] `map.tilemap.options.minZoom:` {ess-icon} {ece-icon}
| The minimum zoom level. *Default: `1`*

| [[tilemap-subdomains]] `map.tilemap.options.subdomains:`
| [[tilemap-subdomains]] `map.tilemap.options.subdomains:` {ess-icon} {ece-icon}
| An array of subdomains
used by the tile service. Specify the position of the subdomain the URL with
the token `{s}`. Supported on {ece}.
the token `{s}`.

| [[tilemap-url]] `map.tilemap.url:`
| [[tilemap-url]] `map.tilemap.url:` {ess-icon} {ece-icon}
| The URL to the tileservice that {kib} uses
to display map tiles in tilemap visualizations. Supported on {ece}. By default,
to display map tiles in tilemap visualizations. By default,
{kib} reads this URL from an external metadata service, but users can
override this parameter to use their own Tile Map Service. For example:
`"https://tiles.elastic.co/v2/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana"`
Expand Down Expand Up @@ -451,7 +450,7 @@ deprecation warning at startup. This setting cannot end in a slash (`/`).
proxy sitting in front of it. This determines whether HTTP compression may be used for responses, based on the request `Referer` header.
This setting may not be used when `server.compression.enabled` is set to `false`. *Default: `none`*

| `server.customResponseHeaders:`
| `server.customResponseHeaders:` {ess-icon}
| Header names and values to
send on all responses to the client from the {kib} server. *Default: `{}`*

Expand Down Expand Up @@ -610,7 +609,7 @@ us improve your user experience. Your data is never shared with anyone. Set to
`false` to disable telemetry capabilities entirely. You can alternatively opt
out through *Advanced Settings*. *Default: `true`*

| `vis_type_vega.enableExternalUrls:`
| `vis_type_vega.enableExternalUrls:` {ess-icon}
| 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`*

Expand All @@ -622,7 +621,7 @@ disable the License Management UI. *Default: `true`*
| Set this value to false to disable the
Rollup UI. *Default: true*

| `i18n.locale`
| `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
13 changes: 2 additions & 11 deletions docs/user/getting-started.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,9 @@ Ready to try out {kib} and see what it can do? To quickest way to get started wi

[float]
[[cloud-set-up]]
== Set up on Cloud
== Set up on cloud

To access {kib} in a single click, run our hosted Elasticsearch Service on Elastic Cloud.

. Log into the link:https://cloud.elastic.co/[Elasticsearch Service Console].
If you need an account, register for a link:https://www.elastic.co/cloud/elasticsearch-service/signup[free 14-day trial].

. Click *Create deployment*, then give your deployment a name.

. To use the default options, click *Create deployment*. You can modify the other deployment options, but the default options are great to get started.

Be sure to copy down the password for the `elastic` user and Cloud ID information. You'll need that later.
include::{docs-root}/shared/cloud/ess-getting-started.asciidoc[]

[float]
[[get-data-in]]
Expand Down
1 change: 1 addition & 0 deletions src/plugins/bfetch/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { PluginInitializerContext } from '../../../core/server';
import { BfetchServerPlugin } from './plugin';

export { BfetchServerSetup, BfetchServerStart, BatchProcessingRouteParams } from './plugin';
export { StreamingRequestHandler } from './types';

export function plugin(initializerContext: PluginInitializerContext) {
return new BfetchServerPlugin(initializerContext);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/bfetch/server/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const createSetupContract = (): Setup => {
const setupContract: Setup = {
addBatchProcessingRoute: jest.fn(),
addStreamingResponseRoute: jest.fn(),
createStreamingRequestHandler: jest.fn(),
};
return setupContract;
};
Expand Down
68 changes: 61 additions & 7 deletions src/plugins/bfetch/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {
Plugin,
Logger,
KibanaRequest,
RouteMethod,
RequestHandler,
} from 'src/core/server';
import { schema } from '@kbn/config-schema';
import { Subject } from 'rxjs';
Expand All @@ -35,6 +37,7 @@ import {
removeLeadingSlash,
normalizeError,
} from '../common';
import { StreamingRequestHandler } from './types';
import { createNDJSONStream } from './streaming';

// eslint-disable-next-line
Expand All @@ -47,6 +50,7 @@ export interface BatchProcessingRouteParams<BatchItemData, BatchItemResult> {
onBatchItem: (data: BatchItemData) => Promise<BatchItemResult>;
}

/** @public */
export interface BfetchServerSetup {
addBatchProcessingRoute: <BatchItemData extends object, BatchItemResult extends object>(
path: string,
Expand All @@ -56,11 +60,48 @@ export interface BfetchServerSetup {
path: string,
params: (request: KibanaRequest) => StreamingResponseHandler<Payload, Response>
) => void;
/**
* Create a streaming request handler to be able to use an Observable to return chunked content to the client.
* This is meant to be used with the `fetchStreaming` API of the `bfetch` client-side plugin.
*
* @example
* ```ts
* setup({ http }: CoreStart, { bfetch }: SetupDeps) {
* const router = http.createRouter();
* router.post(
* {
* path: '/api/my-plugin/stream-endpoint,
* validate: {
* body: schema.object({
* term: schema.string(),
* }),
* }
* },
* bfetch.createStreamingResponseHandler(async (ctx, req) => {
* const { term } = req.body;
* const results$ = await myApi.getResults$(term);
* return results$;
* })
* )}
*
* ```
*
* @param streamHandler
*/
createStreamingRequestHandler: <Response, P, Q, B, Method extends RouteMethod = any>(
streamHandler: StreamingRequestHandler<Response, P, Q, B, Method>
) => RequestHandler<P, Q, B, Method>;
}

// eslint-disable-next-line
export interface BfetchServerStart {}

const streamingHeaders = {
'Content-Type': 'application/x-ndjson',
Connection: 'keep-alive',
'Transfer-Encoding': 'chunked',
};

export class BfetchServerPlugin
implements
Plugin<
Expand All @@ -76,10 +117,12 @@ export class BfetchServerPlugin
const router = core.http.createRouter();
const addStreamingResponseRoute = this.addStreamingResponseRoute({ router, logger });
const addBatchProcessingRoute = this.addBatchProcessingRoute(addStreamingResponseRoute);
const createStreamingRequestHandler = this.createStreamingRequestHandler({ logger });

return {
addBatchProcessingRoute,
addStreamingResponseRoute,
createStreamingRequestHandler,
};
}

Expand All @@ -106,19 +149,30 @@ export class BfetchServerPlugin
async (context, request, response) => {
const handlerInstance = handler(request);
const data = request.body;
const headers = {
'Content-Type': 'application/x-ndjson',
Connection: 'keep-alive',
'Transfer-Encoding': 'chunked',
};
return response.ok({
headers,
body: createNDJSONStream(data, handlerInstance, logger),
headers: streamingHeaders,
body: createNDJSONStream(handlerInstance.getResponseStream(data), logger),
});
}
);
};

private createStreamingRequestHandler = ({
logger,
}: {
logger: Logger;
}): BfetchServerSetup['createStreamingRequestHandler'] => streamHandler => async (
context,
request,
response
) => {
const response$ = await streamHandler(context, request);
return response.ok({
headers: streamingHeaders,
body: createNDJSONStream(response$, logger),
});
};

private addBatchProcessingRoute = (
addStreamingResponseRoute: BfetchServerSetup['addStreamingResponseRoute']
): BfetchServerSetup['addBatchProcessingRoute'] => <
Expand Down
8 changes: 3 additions & 5 deletions src/plugins/bfetch/server/streaming/create_ndjson_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@
* under the License.
*/

import { Observable } from 'rxjs';
import { Logger } from 'src/core/server';
import { Stream, PassThrough } from 'stream';
import { StreamingResponseHandler } from '../../common/types';

const delimiter = '\n';

export const createNDJSONStream = <Payload, Response>(
payload: Payload,
handler: StreamingResponseHandler<Payload, Response>,
export const createNDJSONStream = <Response>(
results: Observable<Response>,
logger: Logger
): Stream => {
const stream = new PassThrough();
const results = handler.getResponseStream(payload);

results.subscribe({
next: (message: Response) => {
Expand Down
Loading

0 comments on commit b590f8b

Please sign in to comment.