Skip to content

Commit

Permalink
Merge branch 'master' into bump-node-16.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed Oct 11, 2021
2 parents a0bc1b5 + badc778 commit ec91485
Show file tree
Hide file tree
Showing 276 changed files with 5,912 additions and 2,285 deletions.
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 modified docs/developer/advanced/images/sharing-saved-objects-step-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 9 additions & 6 deletions docs/developer/advanced/sharing-saved-objects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ export class MyPlugin implements Plugin<{}, {}, {}, PluginStartDeps> {
if (spacesApi && resolveResult.outcome === 'aliasMatch') {
// We found this object by a legacy URL alias from its old ID; redirect the user to the page with its new ID, preserving any URL hash
const newObjectId = resolveResult.alias_target_id!; // This is always defined if outcome === 'aliasMatch'
const newPath = http.basePath.prepend(
`path/to/this/page/${newObjectId}${window.location.hash}`
);
const newPath = `/this/page/${newObjectId}${window.location.hash}`; // Use the *local* path within this app (do not include the "/app/appId" prefix)
await spacesApi.ui.redirectLegacyUrl(newPath, OBJECT_NOUN);
return;
}
Expand All @@ -255,9 +253,7 @@ const getLegacyUrlConflictCallout = () => {
// callout with a warning for the user, and provide a way for them to navigate to the other object.
const currentObjectId = savedObject.id;
const otherObjectId = resolveResult.alias_target_id!; // This is always defined if outcome === 'conflict'
const otherObjectPath = http.basePath.prepend(
`path/to/this/page/${otherObjectId}${window.location.hash}`
);
const otherObjectPath = `/this/page/${otherObjectId}${window.location.hash}`; // Use the *local* path within this app (do not include the "/app/appId" prefix)
return (
<>
{spacesApi.ui.components.getLegacyUrlConflict({
Expand Down Expand Up @@ -391,6 +387,13 @@ These should be handled on a case-by-case basis at the plugin owner's discretion
* Any "secondary" objects on the page may handle the outcomes differently. If the secondary object ID is not important (for example, it just
functions as a page anchor), it may make more sense to ignore the different outcomes. If the secondary object _is_ important but it is not
directly represented in the UI, it may make more sense to throw a descriptive error when a `'conflict'` outcome is encountered.
- Embeddables should use `spacesApi.ui.components.getEmbeddableLegacyUrlConflict` to render conflict errors:
+
image::images/sharing-saved-objects-faq-multiple-deep-link-objects-1.png["Sharing Saved Objects embeddable legacy URL conflict"]
Viewing details shows the user how to disable the alias and fix the problem using the
<<spaces-api-disable-legacy-url-aliases,_disable_legacy_url_aliases API>>:
+
image::images/sharing-saved-objects-faq-multiple-deep-link-objects-2.png["Sharing Saved Objects embeddable legacy URL conflict (showing details)"]
- If the secondary object is resolved by an external service (such as the index pattern service), the service should simply make the full
outcome available to consumers.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ readonly links: {
datastreamsNamingScheme: string;
upgradeElasticAgent: string;
upgradeElasticAgent712lower: string;
learnMoreBlog: string;
}>;
readonly ecs: {
readonly guide: string;
Expand Down
48 changes: 31 additions & 17 deletions docs/settings/apm-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,57 +40,71 @@ Changing these settings may disable features of the APM App.

[cols="2*<"]
|===
| `xpack.apm.enabled`
| `xpack.apm.enabled` {ess-icon}
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `false` to disable the APM app. Defaults to `true`.

| `xpack.apm.maxServiceEnvironments`
| `xpack.apm.maxServiceEnvironments` {ess-icon}
| Maximum number of unique service environments recognized by the UI. Defaults to `100`.

| `xpack.apm.serviceMapFingerprintBucketSize`
| `xpack.apm.serviceMapFingerprintBucketSize` {ess-icon}
| Maximum number of unique transaction combinations sampled for generating service map focused on a specific service. Defaults to `100`.

| `xpack.apm.serviceMapFingerprintGlobalBucketSize`
| `xpack.apm.serviceMapFingerprintGlobalBucketSize` {ess-icon}
| Maximum number of unique transaction combinations sampled for generating the global service map. Defaults to `100`.

| `xpack.apm.serviceMapEnabled` {ess-icon}
| Set to `false` to disable service maps. Defaults to `true`.

| `xpack.apm.serviceMapTraceIdBucketSize` {ess-icon}
| Maximum number of trace IDs sampled for generating service map focused on a specific service. Defaults to `65`.

| `xpack.apm.serviceMapTraceIdGlobalBucketSize` {ess-icon}
| Maximum number of trace IDs sampled for generating the global service map. Defaults to `6`.

| `xpack.apm.serviceMapMaxTracesPerRequest` {ess-icon}
| Maximum number of traces per request for generating the global service map. Defaults to `50`.

| `xpack.apm.ui.enabled` {ess-icon}
| Set to `false` to hide the APM app from the main menu. Defaults to `true`.

| `xpack.apm.ui.transactionGroupBucketSize`
| `xpack.apm.ui.transactionGroupBucketSize` {ess-icon}
| Number of top transaction groups displayed in the APM app. Defaults to `1000`.

| `xpack.apm.ui.maxTraceItems` {ess-icon}
| Maximum number of child items displayed when viewing trace details. Defaults to `1000`.

| `xpack.observability.annotations.index`
| `xpack.observability.annotations.index` {ess-icon}
| Index name where Observability annotations are stored. Defaults to `observability-annotations`.

| `xpack.apm.searchAggregatedTransactions`
| `xpack.apm.searchAggregatedTransactions` {ess-icon}
| experimental[] Enables Transaction histogram metrics. Defaults to `never` and aggregated transactions are not used. When set to `auto`, the UI will use metric indices over transaction indices for transactions if aggregated transactions are found. When set to `always`, additional configuration in APM Server is required.
See {apm-server-ref-v}/transaction-metrics.html[Configure transaction metrics] for more information.

| `apm_oss.indexPattern` {ess-icon}
| The index pattern used for integrations with Machine Learning and Query Bar.
It must match all apm indices. Defaults to `apm-*`.
| `xpack.apm.metricsInterval` {ess-icon}
| Sets a `fixed_interval` for date histograms in metrics aggregations. Defaults to `30`.

| `xpack.apm.agent.migrations.enabled` {ess-icon}
| Set to `false` to disable cloud APM migrations. Defaults to `true`.

| `apm_oss.errorIndices` {ess-icon}
| `xpack.apm.errorIndices` {ess-icon}
| Matcher for all {apm-server-ref}/error-indices.html[error indices]. Defaults to `apm-*`.

| `apm_oss.onboardingIndices`
| `xpack.apm.onboardingIndices` {ess-icon}
| Matcher for all onboarding indices. Defaults to `apm-*`.

| `apm_oss.spanIndices` {ess-icon}
| `xpack.apm.spanIndices` {ess-icon}
| Matcher for all {apm-server-ref}/span-indices.html[span indices]. Defaults to `apm-*`.

| `apm_oss.transactionIndices` {ess-icon}
| `xpack.apm.transactionIndices` {ess-icon}
| Matcher for all {apm-server-ref}/transaction-indices.html[transaction indices]. Defaults to `apm-*`.

| `apm_oss.metricsIndices`
| `xpack.apm.metricsIndices` {ess-icon}
| Matcher for all {apm-server-ref}/metricset-indices.html[metrics indices]. Defaults to `apm-*`.

| `apm_oss.sourcemapIndices`
| `xpack.apm.sourcemapIndices` {ess-icon}
| Matcher for all {apm-server-ref}/sourcemap-indices.html[source map indices]. Defaults to `apm-*`.

|===

// end::general-apm-settings[]
// end::general-apm-settings[]
2 changes: 1 addition & 1 deletion docs/settings/security-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ There is a very limited set of cases when you'd want to change these settings. F
| Determines if HTTP authentication schemes used by the enabled authentication providers should be automatically supported during HTTP authentication. By default, this setting is set to `true`.

| `xpack.security.authc.http.schemes[]`
| List of HTTP authentication schemes that {kib} HTTP authentication should support. By default, this setting is set to `['apikey']` to support HTTP authentication with <<api-keys, `ApiKey`>> scheme.
| List of HTTP authentication schemes that {kib} HTTP authentication should support. By default, this setting is set to `['apikey', 'bearer']` to support HTTP authentication with the <<api-keys, `ApiKey`>> and <<http-authentication, `Bearer`>> schemes.

|===

Expand Down
6 changes: 3 additions & 3 deletions docs/user/security/authentication/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,14 @@ This type of authentication is usually useful for machine-to-machine interaction

By default {kib} supports <<api-keys, `ApiKey`>> authentication scheme _and_ any scheme supported by the currently enabled authentication provider. For example, `Basic` authentication scheme is automatically supported when basic authentication provider is enabled, or `Bearer` scheme when any of the token based authentication providers is enabled (Token, SAML, OpenID Connect, PKI or Kerberos). But it's also possible to add support for any other authentication scheme in the `kibana.yml` configuration file, as follows:

NOTE: Don't forget to explicitly specify default `apikey` scheme when you just want to add a new one to the list.
NOTE: Don't forget to explicitly specify the default `apikey` and `bearer` schemes when you just want to add a new one to the list.

[source,yaml]
--------------------------------------------------------------------------------
xpack.security.authc.http.schemes: [apikey, basic, something-custom]
xpack.security.authc.http.schemes: [apikey, bearer, basic, something-custom]
--------------------------------------------------------------------------------

With this configuration, you can send requests to {kib} with the `Authorization` header using `ApiKey`, `Basic` or `Something-Custom` HTTP schemes (case insensitive). Under the hood, {kib} relays this header to {es}, then {es} authenticates the request using the credentials in the header.
With this configuration, you can send requests to {kib} with the `Authorization` header using `ApiKey`, `Bearer`, `Basic` or `Something-Custom` HTTP schemes (case insensitive). Under the hood, {kib} relays this header to {es}, then {es} authenticates the request using the credentials in the header.

[float]
[[embedded-content-authentication]]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
"@hapi/boom": "^9.1.4",
"@hapi/cookie": "^11.0.2",
"@hapi/h2o2": "^9.1.0",
"@hapi/hapi": "^20.2.0",
"@hapi/hoek": "^9.2.0",
"@hapi/hapi": "^20.2.1",
"@hapi/hoek": "^9.2.1",
"@hapi/inert": "^6.0.4",
"@hapi/wreck": "^17.1.0",
"@kbn/ace": "link:bazel-bin/packages/kbn-ace",
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-cli-dev-mode/src/optimizer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import { Optimizer, Options } from './optimizer';

jest.mock('@kbn/optimizer');
const realOptimizer = jest.requireActual('@kbn/optimizer');
const { runOptimizer, OptimizerConfig, logOptimizerState } = jest.requireMock('@kbn/optimizer');
const { runOptimizer, OptimizerConfig, logOptimizerState, logOptimizerProgress } =
jest.requireMock('@kbn/optimizer');

logOptimizerState.mockImplementation(realOptimizer.logOptimizerState);
logOptimizerProgress.mockImplementation(realOptimizer.logOptimizerProgress);

class MockOptimizerConfig {}

Expand Down
9 changes: 8 additions & 1 deletion packages/kbn-cli-dev-mode/src/optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ import {
} from '@kbn/dev-utils';
import * as Rx from 'rxjs';
import { ignoreElements } from 'rxjs/operators';
import { runOptimizer, OptimizerConfig, logOptimizerState, OptimizerUpdate } from '@kbn/optimizer';
import {
runOptimizer,
OptimizerConfig,
logOptimizerState,
logOptimizerProgress,
OptimizerUpdate,
} from '@kbn/optimizer';

export interface Options {
enabled: boolean;
Expand Down Expand Up @@ -111,6 +117,7 @@ export class Optimizer {
subscriber.add(
runOptimizer(config)
.pipe(
logOptimizerProgress(log),
logOptimizerState(log, config),
tap(({ state }) => {
this.phase$.next(state.phase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import Path from 'path';
import crypto from 'crypto';
import execa from 'execa';
import Axios from 'axios';
// @ts-expect-error not "public", but necessary to prevent Jest shimming from breaking things
import httpAdapter from 'axios/lib/adapters/http';

import { ToolingLog } from '../tooling_log';
import { parseConfig, Config } from './ci_stats_config';
Expand Down Expand Up @@ -225,6 +227,7 @@ export class CiStatsReporter {
baseURL: BASE_URL,
headers,
data: body,
adapter: httpAdapter,
});

return true;
Expand Down
15 changes: 14 additions & 1 deletion packages/kbn-optimizer/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { lastValueFrom } from '@kbn/std';
import { run, createFlagError, Flags } from '@kbn/dev-utils';

import { logOptimizerState } from './log_optimizer_state';
import { logOptimizerProgress } from './log_optimizer_progress';
import { OptimizerConfig } from './optimizer';
import { runOptimizer } from './run_optimizer';
import { validateLimitsForAllBundles, updateBundleLimits } from './limits';
Expand Down Expand Up @@ -97,6 +98,11 @@ export function runKbnOptimizerCli(options: { defaultLimitsPath: string }) {
throw createFlagError('expected --report-stats to have no value');
}

const logProgress = flags.progress ?? false;
if (typeof logProgress !== 'boolean') {
throw createFlagError('expected --progress to have no value');
}

const filter = typeof flags.filter === 'string' ? [flags.filter] : flags.filter;
if (!Array.isArray(filter) || !filter.every((f) => typeof f === 'string')) {
throw createFlagError('expected --filter to be one or more strings');
Expand Down Expand Up @@ -144,7 +150,11 @@ export function runKbnOptimizerCli(options: { defaultLimitsPath: string }) {
const update$ = runOptimizer(config);

await lastValueFrom(
update$.pipe(logOptimizerState(log, config), reportOptimizerTimings(log, config))
update$.pipe(
logProgress ? logOptimizerProgress(log) : (x) => x,
logOptimizerState(log, config),
reportOptimizerTimings(log, config)
)
);

if (updateLimits) {
Expand All @@ -169,19 +179,22 @@ export function runKbnOptimizerCli(options: { defaultLimitsPath: string }) {
'inspect-workers',
'validate-limits',
'update-limits',
'progress',
],
string: ['workers', 'scan-dir', 'filter', 'limits'],
default: {
core: true,
examples: true,
cache: true,
'inspect-workers': true,
progress: true,
filter: [],
focus: [],
},
help: `
--watch run the optimizer in watch mode
--workers max number of workers to use
--no-progress disable logging of progress information
--oss only build oss plugins
--profile profile the webpack builds and write stats.json files to build outputs
--no-core disable generating the core bundle
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
export { OptimizerConfig } from './optimizer';
export * from './run_optimizer';
export * from './log_optimizer_state';
export * from './log_optimizer_progress';
export * from './node';
export * from './limits';
export * from './cli';
Expand Down
62 changes: 62 additions & 0 deletions packages/kbn-optimizer/src/log_optimizer_progress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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 { ToolingLog } from '@kbn/dev-utils';
import * as Rx from 'rxjs';
import { tap } from 'rxjs/operators';

import { OptimizerUpdate } from './run_optimizer';

const PROGRESS_REPORT_INTERVAL = 10_000;

export function logOptimizerProgress(
log: ToolingLog
): Rx.MonoTypeOperatorFunction<OptimizerUpdate> {
return (update$) =>
new Rx.Observable((subscriber) => {
const allBundleIds = new Set();
const completeBundles = new Set();
let loggedCompletion = new Set();

// catalog bundle ids and which have completed at least once, forward
// updates to next subscriber
subscriber.add(
update$
.pipe(
tap(({ state }) => {
for (const { bundleId, type } of state.compilerStates) {
allBundleIds.add(bundleId);
if (type !== 'running') {
completeBundles.add(bundleId);
}
}
}),
tap(subscriber)
)
.subscribe()
);

// on interval check to see if at least 3 new bundles have completed at
// least one build and log about our progress if so
subscriber.add(
Rx.interval(PROGRESS_REPORT_INTERVAL).subscribe(
() => {
if (completeBundles.size - loggedCompletion.size < 3) {
return;
}

log.info(
`[${completeBundles.size}/${allBundleIds.size}] initial bundle builds complete`
);
loggedCompletion = new Set(completeBundles);
},
(error) => subscriber.error(error)
)
);
});
}
7 changes: 2 additions & 5 deletions packages/kbn-optimizer/src/log_optimizer_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,11 @@ export function logOptimizerState(log: ToolingLog, config: OptimizerConfig) {
continue;
}

bundleStates.set(id, type);

if (type === 'running') {
bundlesThatWereBuilt.add(id);
}

bundleStates.set(id, type);
log.debug(
`[${id}] state = "${type}"${type !== 'running' ? ` after ${state.durSec} sec` : ''}`
);
}

if (state.phase === 'running' || state.phase === 'initializing') {
Expand Down
6 changes: 5 additions & 1 deletion packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8965,6 +8965,8 @@ var _execa = _interopRequireDefault(__webpack_require__(134));

var _axios = _interopRequireDefault(__webpack_require__(177));

var _http = _interopRequireDefault(__webpack_require__(199));

var _ci_stats_config = __webpack_require__(218);

/*
Expand All @@ -8974,6 +8976,7 @@ var _ci_stats_config = __webpack_require__(218);
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
// @ts-expect-error not "public", but necessary to prevent Jest shimming from breaking things
const BASE_URL = 'https://ci-stats.kibana.dev';

class CiStatsReporter {
Expand Down Expand Up @@ -9173,7 +9176,8 @@ class CiStatsReporter {
url: path,
baseURL: BASE_URL,
headers,
data: body
data: body,
adapter: _http.default
});
return true;
} catch (error) {
Expand Down
Loading

0 comments on commit ec91485

Please sign in to comment.