Skip to content

Commit

Permalink
Merge branch 'main' of github.com:elastic/kibana into chore/move-expl…
Browse files Browse the repository at this point in the history
…oratory-view-to-separate-app-with-git-history
  • Loading branch information
CoenWarmer committed Mar 28, 2023
2 parents 5a11c95 + 3b51184 commit 0ef113b
Show file tree
Hide file tree
Showing 232 changed files with 7,647 additions and 2,390 deletions.
5 changes: 3 additions & 2 deletions docs/user/alerting/create-and-manage-rules.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ responses:
Click the rule name to access a rule details page:

[role="screenshot"]
image::images/rule-details-alerts-active.png[Rule details page with three alerts]
image::images/rule-details-alerts-active.png[Rule details page with multiple alerts]
// NOTE: This is an autogenerated screenshot. Do not edit it directly.

In this example, the rule detects when a site serves more than a threshold number of bytes in a 24 hour period. Four sites are above the threshold. These are called alerts - occurrences of the condition being detected - and the alert name, status, time of detection, and duration of the condition are shown in this view. Alerts come and go from the list depending on whether the rule conditions are met.

Expand All @@ -182,4 +183,4 @@ You can suppress future actions for a specific alert by turning on the *Mute* to

[role="screenshot"]
image::images/rule-details-disabling.png[Use the disable toggle to turn off rule checks and clear alerts tracked]

// NOTE: This is an autogenerated screenshot. Do not edit it directly.
Binary file modified docs/user/alerting/images/individual-enable-disable.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/user/alerting/images/rule-details-alerts-active.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/user/alerting/images/rule-details-disabling.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/user/alerting/images/rules-ui.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/user/alerting/images/snooze-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@dnd-kit/utilities": "^2.0.0",
"@elastic/apm-rum": "^5.12.0",
"@elastic/apm-rum-react": "^1.4.2",
"@elastic/charts": "53.1.0",
"@elastic/charts": "54.0.0",
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/[email protected]",
"@elastic/ems-client": "8.4.0",
Expand Down Expand Up @@ -1302,7 +1302,7 @@
"apidoc-markdown": "^7.2.4",
"argsplit": "^1.0.5",
"autoprefixer": "^10.4.7",
"axe-core": "^4.0.2",
"axe-core": "^4.6.1",
"babel-jest": "^29.3.1",
"babel-loader": "^8.2.5",
"babel-plugin-add-module-exports": "^1.0.4",
Expand Down

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

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 @@ -46,7 +46,7 @@ import { HeaderActionMenu } from './header_action_menu';
import { HeaderExtension } from './header_extension';
import { HeaderTopBanner } from './header_top_banner';
import { HeaderMenuButton } from './header_menu_button';
import { ScreenReaderRouteAnnouncements } from './screen_reader_a11y';
import { ScreenReaderRouteAnnouncements, SkipToMainContent } from './screen_reader_a11y';

export interface HeaderProps {
kibanaVersion: string;
Expand Down Expand Up @@ -114,6 +114,7 @@ export function Header({
customBranding$={customBranding$}
appId$={application.currentAppId$}
/>
<SkipToMainContent />

<HeaderTopBanner headerBanner$={observables.headerBanner$} />
<header className={className} data-test-subj="headerGlobalNav">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import React from 'react';
import { BehaviorSubject } from 'rxjs';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import { ScreenReaderRouteAnnouncements } from './screen_reader_a11y';
import { mount } from 'enzyme';
import { ScreenReaderRouteAnnouncements, SkipToMainContent } from './screen_reader_a11y';
import { mount, render } from 'enzyme';

describe('ScreenReaderRouteAnnouncements', () => {
it('renders', () => {
Expand Down Expand Up @@ -67,3 +67,10 @@ describe('ScreenReaderRouteAnnouncements', () => {
).toBeTruthy();
});
});

describe('SkipToMainContent', () => {
it('renders', () => {
const component = render(<SkipToMainContent />);
expect(component).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import React, { FC, useState, useEffect } from 'react';
import useObservable from 'react-use/lib/useObservable';
import { EuiScreenReaderLive } from '@elastic/eui';
import { EuiScreenReaderLive, EuiSkipLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import type { InternalApplicationStart } from '@kbn/core-application-browser-internal';
import type { HeaderProps } from './header';
Expand Down Expand Up @@ -56,3 +57,25 @@ export const ScreenReaderRouteAnnouncements: FC<{
</EuiScreenReaderLive>
);
};

const fallbackContentQueries = [
'main', // Ideal target for all plugins using KibanaPageTemplate
'[role="main"]', // Fallback for plugins using deprecated EuiPageContent
'.kbnAppWrapper', // Last-ditch fallback for all plugins regardless of page template
];

export const SkipToMainContent = () => {
return (
<EuiSkipLink
position="fixed"
destinationId="" // TODO: Potentially allow this to be customizable per-plugin
fallbackDestination={fallbackContentQueries}
overrideLinkBehavior
href="" // Render a button
>
{i18n.translate('core.ui.skipToMainButton', {
defaultMessage: 'Skip to main content',
})}
</EuiSkipLink>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {
type IndexMapping,
type IndexMappingMeta,
type SavedObjectsTypeMappingDefinitions,
type IndexMappingMigrationStateMeta,
} from './src/mappings';
export { SavedObjectsSerializer } from './src/serialization';
export { SavedObjectsTypeValidator } from './src/validation';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
*/

export { getTypes, getProperty, getRootProperties, getRootPropertiesObjects } from './lib';
export type { SavedObjectsTypeMappingDefinitions, IndexMappingMeta, IndexMapping } from './types';
export type {
SavedObjectsTypeMappingDefinitions,
IndexMappingMeta,
IndexMapping,
IndexMappingMigrationStateMeta,
} from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,19 @@ export interface IndexMappingMeta {
* @remark: Only defined for indices using the zdt migration algorithm.
*/
docVersions?: { [k: string]: number };
/**
* Info about the current state of the migration.
* Should only be present if a migration is in progress or was interrupted.
*
* @remark: Only defined for indices using the zdt migration algorithm.
*/
migrationState?: IndexMappingMigrationStateMeta;
}

/** @internal */
export interface IndexMappingMigrationStateMeta {
/**
* Indicates that the algorithm is currently converting the documents.
*/
convertingDocuments: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,57 @@ import type { IndexMapping, IndexMappingMeta } from '../mappings';
import type { ModelVersionMap } from './version_map';
import { assertValidModelVersion } from './conversion';

export interface GetModelVersionsFromMappingsOpts {
mappings: IndexMapping;
source: 'mappingVersions' | 'docVersions';
/** if specified, will filter the types with the provided list */
knownTypes?: string[];
}

/**
* Build the version map from the specified source of the provided mappings.
*/
export const getModelVersionsFromMappings = ({
mappings,
source,
}: {
mappings: IndexMapping;
source: 'mappingVersions' | 'docVersions';
}): ModelVersionMap | undefined => {
knownTypes,
}: GetModelVersionsFromMappingsOpts): ModelVersionMap | undefined => {
if (!mappings._meta) {
return undefined;
}

return getModelVersionsFromMappingMeta({
meta: mappings._meta,
source,
knownTypes,
});
};

export interface GetModelVersionsFromMappingMetaOpts {
meta: IndexMappingMeta;
source: 'mappingVersions' | 'docVersions';
/** if specified, will filter the types with the provided list */
knownTypes?: string[];
}

/**
* Build the version map from the specified source of the provided mappings meta.
*/
export const getModelVersionsFromMappingMeta = ({
meta,
source,
}: {
meta: IndexMappingMeta;
source: 'mappingVersions' | 'docVersions';
}): ModelVersionMap | undefined => {
knownTypes,
}: GetModelVersionsFromMappingMetaOpts): ModelVersionMap | undefined => {
const indexVersions = source === 'mappingVersions' ? meta.mappingVersions : meta.docVersions;
if (!indexVersions) {
return undefined;
}
const typeSet = knownTypes ? new Set(knownTypes) : undefined;

return Object.entries(indexVersions).reduce<ModelVersionMap>((map, [type, rawVersion]) => {
map[type] = assertValidModelVersion(rawVersion);
if (!typeSet || typeSet.has(type)) {
map[type] = assertValidModelVersion(rawVersion);
}
return map;
}, {});
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const migrationSchema = schema.object({
pollInterval: schema.number({ defaultValue: 1_500 }),
skip: schema.boolean({ defaultValue: false }),
retryAttempts: schema.number({ defaultValue: 15 }),
zdt: schema.object({
metaPickupSyncDelaySec: schema.number({ min: 1, defaultValue: 120 }),
}),
});

export type SavedObjectsMigrationConfigType = TypeOf<typeof migrationSchema>;
Expand Down Expand Up @@ -60,6 +63,7 @@ export const savedObjectsConfig: ServiceConfigDescriptor<SavedObjectsConfigType>
path: 'savedObjects',
schema: soSchema,
};

export class SavedObjectConfig {
public maxImportPayloadBytes: number;
public maxImportExportSize: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
*/

export const CLUSTER_SHARD_LIMIT_EXCEEDED_REASON = `[cluster_shard_limit_exceeded] Upgrading Kibana requires adding a small number of new shards. Ensure that Kibana is able to add 10 more shards by increasing the cluster.max_shards_per_node setting, or removing indices to clear up resources.`;

export const FATAL_REASON_REQUEST_ENTITY_TOO_LARGE = `While indexing a batch of saved objects, Elasticsearch returned a 413 Request Entity Too Large exception. Ensure that the Kibana configuration option 'migrations.maxBatchSizeBytes' is set to a value that is lower than or equal to the Elasticsearch 'http.max_content_length' configuration option.`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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 type { BulkOperationContainer } from '@elastic/elasticsearch/lib/api/types';
import type { BulkOperation } from '../model/create_batches';

export const redactBulkOperationBatches = (
bulkOperationBatches: BulkOperation[][]
): BulkOperationContainer[][] => {
return bulkOperationBatches.map((batch) =>
batch.map((operation) => (Array.isArray(operation) ? operation[0] : operation))
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import type {
SavedObjectSanitizedDoc,
SavedObjectsRawDoc,
SavedObjectUnsanitizedDoc,
ISavedObjectsSerializer,
} from '@kbn/core-saved-objects-server';
import { SavedObjectsSerializer } from '@kbn/core-saved-objects-base-server-internal';
import type { MigrateAndConvertFn } from '../document_migrator/document_migrator';
import { TransformSavedObjectDocumentError } from '.';

Expand Down Expand Up @@ -65,7 +65,7 @@ export class CorruptSavedObjectError extends Error {
* @returns {SavedObjectsRawDoc[]}
*/
export async function migrateRawDocs(
serializer: SavedObjectsSerializer,
serializer: ISavedObjectsSerializer,
migrateDoc: MigrateAndConvertFn,
rawDocs: SavedObjectsRawDoc[]
): Promise<SavedObjectsRawDoc[]> {
Expand All @@ -86,7 +86,7 @@ export async function migrateRawDocs(
}

interface MigrateRawDocsSafelyDeps {
serializer: SavedObjectsSerializer;
serializer: ISavedObjectsSerializer;
migrateDoc: MigrateAndConvertFn;
rawDocs: SavedObjectsRawDoc[];
}
Expand Down Expand Up @@ -181,7 +181,7 @@ function transformNonBlocking(
async function migrateMapToRawDoc(
migrateMethod: MigrateFn,
savedObject: SavedObjectSanitizedDoc<unknown>,
serializer: SavedObjectsSerializer
serializer: ISavedObjectsSerializer
): Promise<SavedObjectsRawDoc[]> {
return [...(await migrateMethod(savedObject))].map((attrs) =>
serializer.savedObjectToRaw({
Expand All @@ -201,7 +201,7 @@ async function migrateMapToRawDoc(
function convertToRawAddMigrationVersion(
rawDoc: SavedObjectsRawDoc,
options: { namespaceTreatment: 'lax' },
serializer: SavedObjectsSerializer
serializer: ISavedObjectsSerializer
): SavedObjectSanitizedDoc<unknown> {
const savedObject = serializer.rawToSavedObject(rawDoc, options);
if (!savedObject.migrationVersion && !savedObject.typeMigrationVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ const mockOptions = () => {
scrollDuration: '10m',
skip: false,
retryAttempts: 20,
zdt: {
metaPickupSyncDelaySec: 120,
},
},
client: mockedClient,
docLinks: docLinksServiceMock.createSetupContract(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ describe('migrationsStateActionMachine', () => {
scrollDuration: '0s',
skip: false,
retryAttempts: 5,
zdt: {
metaPickupSyncDelaySec: 120,
},
},
typeRegistry,
docLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ import {
getRequestDebugMeta,
} from '@kbn/core-elasticsearch-client-server-internal';
import type { SavedObjectsRawDoc } from '@kbn/core-saved-objects-server';
import type { BulkOperationContainer } from '@elastic/elasticsearch/lib/api/types';
import { logActionResponse, logStateTransition } from './common/utils/logs';
import { type Model, type Next, stateActionMachine } from './state_action_machine';
import { cleanup } from './migrations_state_machine_cleanup';
import type { ReindexSourceToTempTransform, ReindexSourceToTempIndexBulk, State } from './state';
import type { BulkOperation } from './model/create_batches';
import { redactBulkOperationBatches } from './common/redact_state';

/**
* A specialized migrations-specific state-action machine that:
Expand Down Expand Up @@ -159,11 +158,3 @@ export async function migrationStateActionMachine({
}
}
}

const redactBulkOperationBatches = (
bulkOperationBatches: BulkOperation[][]
): BulkOperationContainer[][] => {
return bulkOperationBatches.map((batch) =>
batch.map((operation) => (Array.isArray(operation) ? operation[0] : operation))
);
};
Loading

0 comments on commit 0ef113b

Please sign in to comment.