Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into call-scripts-with…
Browse files Browse the repository at this point in the history
…-preserve-symlinks-in-place
  • Loading branch information
mistic committed Mar 15, 2021
2 parents f8aaaf5 + cd56c13 commit 89850f2
Show file tree
Hide file tree
Showing 13 changed files with 291 additions and 163 deletions.
8 changes: 4 additions & 4 deletions api_docs/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,7 @@
"description": [],
"source": {
"path": "src/core/public/doc_links/doc_links_service.ts",
"lineNumber": 282
"lineNumber": 283
}
},
{
Expand All @@ -1442,7 +1442,7 @@
"description": [],
"source": {
"path": "src/core/public/doc_links/doc_links_service.ts",
"lineNumber": 283
"lineNumber": 284
}
},
{
Expand All @@ -1453,7 +1453,7 @@
"description": [],
"source": {
"path": "src/core/public/doc_links/doc_links_service.ts",
"lineNumber": 284
"lineNumber": 285
},
"signature": [
"{ readonly dashboard: { readonly guide: string; readonly drilldowns: string; readonly drilldownsTriggerPicker: string; readonly urlDrilldownTemplateSyntax: string; readonly urlDrilldownVariables: string; }; readonly discover: Record<string, string>; readonly filebeat: { readonly base: string; readonly installation: string; readonly configuration: string; readonly elasticsearchOutput: string; readonly elasticsearchModule: string; readonly startup: string; readonly exportedFields: string; }; readonly auditbeat: { readonly base: string; }; readonly metricbeat: { readonly base: string; readonly configure: string; readonly httpEndpoint: string; readonly install: string; readonly start: string; }; readonly enterpriseSearch: { readonly base: string; readonly appSearchBase: string; readonly workplaceSearchBase: string; }; readonly heartbeat: { readonly base: string; }; readonly logstash: { readonly base: string; }; readonly functionbeat: { readonly base: string; }; readonly winlogbeat: { readonly base: string; }; readonly aggs: { readonly composite: string; readonly composite_missing_bucket: string; readonly date_histogram: string; readonly date_range: string; readonly date_format_pattern: string; readonly filter: string; readonly filters: string; readonly geohash_grid: string; readonly histogram: string; readonly ip_range: string; readonly range: string; readonly significant_terms: string; readonly terms: string; readonly avg: string; readonly avg_bucket: string; readonly max_bucket: string; readonly min_bucket: string; readonly sum_bucket: string; readonly cardinality: string; readonly count: string; readonly cumulative_sum: string; readonly derivative: string; readonly geo_bounds: string; readonly geo_centroid: string; readonly max: string; readonly median: string; readonly min: string; readonly moving_avg: string; readonly percentile_ranks: string; readonly serial_diff: string; readonly std_dev: string; readonly sum: string; readonly top_hits: string; }; readonly runtimeFields: string; readonly scriptedFields: { readonly scriptFields: string; readonly scriptAggs: string; readonly painless: string; readonly painlessApi: string; readonly painlessLangSpec: string; readonly painlessSyntax: string; readonly painlessWalkthrough: string; readonly luceneExpressions: string; }; readonly indexPatterns: { readonly loadingData: string; readonly introduction: string; }; readonly addData: string; readonly kibana: string; readonly elasticsearch: Record<string, string>; readonly siem: { readonly guide: string; readonly gettingStarted: string; }; readonly query: { readonly eql: string; readonly luceneQuerySyntax: string; readonly queryDsl: string; readonly kueryQuerySyntax: string; }; readonly date: { readonly dateMath: string; readonly dateMathIndexNames: string; }; readonly management: Record<string, string>; readonly ml: Record<string, string>; readonly transforms: Record<string, string>; readonly visualize: Record<string, string>; readonly apis: Readonly<{ createIndex: string; createSnapshotLifecyclePolicy: string; createRoleMapping: string; createRoleMappingTemplates: string; createApiKey: string; createPipeline: string; createTransformRequest: string; cronExpressions: string; executeWatchActionModes: string; indexExists: string; openIndex: string; putComponentTemplate: string; painlessExecute: string; painlessExecuteAPIContexts: string; putComponentTemplateMetadata: string; putSnapshotLifecyclePolicy: string; putWatch: string; updateTransform: string; }>; readonly observability: Record<string, string>; readonly alerting: Record<string, string>; readonly maps: Record<string, string>; readonly monitoring: Record<string, string>; readonly security: Readonly<{ apiKeyServiceSettings: string; clusterPrivileges: string; elasticsearchSettings: string; elasticsearchEnableSecurity: string; indicesPrivileges: string; kibanaTLS: string; kibanaPrivileges: string; mappingRoles: string; mappingRolesFieldRules: string; runAsPrivilege: string; }>; readonly watcher: Record<string, string>; readonly ccs: Record<string, string>; readonly plugins: Record<string, string>; readonly snapshotRestore: Record<string, string>; }"
Expand All @@ -1462,7 +1462,7 @@
],
"source": {
"path": "src/core/public/doc_links/doc_links_service.ts",
"lineNumber": 281
"lineNumber": 282
},
"initialIsOpen": false
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"@cypress/webpack-preprocessor": "^5.5.0",
"@elastic/apm-rum": "^5.6.1",
"@elastic/apm-rum-react": "^1.2.5",
"@elastic/charts": "25.1.0",
"@elastic/charts": "25.3.0",
"@elastic/eslint-config-kibana": "link:packages/elastic-eslint-config-kibana",
"@elastic/eslint-plugin-eui": "0.0.2",
"@elastic/github-checks-reporter": "0.0.20b3",
Expand Down
32 changes: 20 additions & 12 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59566,18 +59566,26 @@ async function runCommand(command, config) {
if (command.reportTiming) {
// if we don't have a kbn object then things are too broken to report on
if (kbn) {
const reporter = _kbn_dev_utils_ci_stats_reporter__WEBPACK_IMPORTED_MODULE_0__["CiStatsReporter"].fromEnv(_utils_log__WEBPACK_IMPORTED_MODULE_2__["log"]);
await reporter.timings({
upstreamBranch: kbn.kibanaProject.json.branch,
timings: [{
group: command.reportTiming.group,
id: command.reportTiming.id,
ms: Date.now() - runStartTime,
meta: {
success: false
}
}]
});
try {
const reporter = _kbn_dev_utils_ci_stats_reporter__WEBPACK_IMPORTED_MODULE_0__["CiStatsReporter"].fromEnv(_utils_log__WEBPACK_IMPORTED_MODULE_2__["log"]);
await reporter.timings({
upstreamBranch: kbn.kibanaProject.json.branch,
// prevent loading @kbn/utils by passing null
kibanaUuid: kbn.getUuid() || null,
timings: [{
group: command.reportTiming.group,
id: command.reportTiming.id,
ms: Date.now() - runStartTime,
meta: {
success: false
}
}]
});
} catch (e) {
// prevent hiding bootstrap errors
_utils_log__WEBPACK_IMPORTED_MODULE_2__["log"].error('failed to report timings:');
_utils_log__WEBPACK_IMPORTED_MODULE_2__["log"].error(e);
}
}
}

Expand Down
34 changes: 21 additions & 13 deletions packages/kbn-pm/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,28 @@ export async function runCommand(command: ICommand, config: Omit<ICommandConfig,
if (command.reportTiming) {
// if we don't have a kbn object then things are too broken to report on
if (kbn) {
const reporter = CiStatsReporter.fromEnv(log);
await reporter.timings({
upstreamBranch: kbn.kibanaProject.json.branch,
timings: [
{
group: command.reportTiming.group,
id: command.reportTiming.id,
ms: Date.now() - runStartTime,
meta: {
success: false,
try {
const reporter = CiStatsReporter.fromEnv(log);
await reporter.timings({
upstreamBranch: kbn.kibanaProject.json.branch,
// prevent loading @kbn/utils by passing null
kibanaUuid: kbn.getUuid() || null,
timings: [
{
group: command.reportTiming.group,
id: command.reportTiming.id,
ms: Date.now() - runStartTime,
meta: {
success: false,
},
},
},
],
});
],
});
} catch (e) {
// prevent hiding bootstrap errors
log.error('failed to report timings:');
log.error(e);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{
groupName: '@elastic/charts',
packageNames: ['@elastic/charts'],
reviewers: ['markov00'],
reviewers: ['markov00', 'nickofthyme'],
matchBaseBranches: ['master'],
labels: ['release_note:skip', 'v8.0.0', 'v7.13.0'],
enabled: true,
Expand Down
3 changes: 2 additions & 1 deletion src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class DocLinksService {
remoteClustersProxy: `${ELASTICSEARCH_DOCS}modules-remote-clusters.html#proxy-mode`,
remoteClusersProxySettings: `${ELASTICSEARCH_DOCS}modules-remote-clusters.html#remote-cluster-proxy-settings`,
scriptParameters: `${ELASTICSEARCH_DOCS}modules-scripting-using.html#prefer-params`,
transportSettings: `${ELASTICSEARCH_DOCS}modules-transport.html`,
transportSettings: `${ELASTICSEARCH_DOCS}modules-network.html`,
},
siem: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/index.html`,
Expand Down Expand Up @@ -235,6 +235,7 @@ export class DocLinksService {
},
ccs: {
guide: `${ELASTICSEARCH_DOCS}modules-cross-cluster-search.html`,
skippingDisconnectedClusters: `${ELASTICSEARCH_DOCS}modules-cross-cluster-search.html#skip-unavailable-clusters`,
},
apis: {
createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`,
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/ml/common/constants/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ export const TRAINING_DOCS_LOWER = 200;
export const INCLUDED_FIELDS_THRESHOLD = 100;
export const MINIMUM_NUM_FIELD_FOR_CHECK = 25;
export const FRACTION_EMPTY_LIMIT = 0.3;
export const NUM_CATEGORIES_THRESHOLD = 10;
export const ALL_CATEGORIES = -1;
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,25 @@
* 2.0.
*/

import React, { FC, useEffect, useState } from 'react';
import React, { FC } from 'react';
import { EuiLoadingSpinner, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { useMlApiContext } from '../../../../../contexts/kibana';
import { extractErrorMessage } from '../../../../../../../common/util/errors';
import { CreateAnalyticsStepProps } from '../../../analytics_management/hooks/use_create_analytics_form';
import { getJobConfigFromFormState } from '../../../analytics_management/hooks/use_create_analytics_form/state';
import {
CalloutMessage,
ValidateAnalyticsJobResponse,
VALIDATION_STATUS,
} from '../../../../../../../common/constants/validation';
import { DataFrameAnalyticsConfig } from '../../../../../../../common/types/data_frame_analytics';
import { CalloutMessage } from '../../../../../../../common/constants/validation';
import { Callout } from '../../../../../components/callout';
import { ANALYTICS_STEPS } from '../../page';
import { ContinueButton } from '../continue_button';
import { ValidationSummary } from './validation_step_wrapper';

interface Props extends CreateAnalyticsStepProps {
setValidationSummary: React.Dispatch<React.SetStateAction<ValidationSummary>>;
interface Props {
setCurrentStep: React.Dispatch<React.SetStateAction<ANALYTICS_STEPS>>;
checksInProgress: boolean;
validationMessages: CalloutMessage[];
}

export const ValidationStep: FC<Props> = ({ state, setCurrentStep, setValidationSummary }) => {
const [checksInProgress, setChecksInProgress] = useState<boolean>(false);
const [validationMessages, setValidationMessages] = useState<CalloutMessage[]>([]);
const [errorMessage, setErrorMessage] = useState<CalloutMessage | undefined>();

const { form, jobConfig, isAdvancedEditorEnabled } = state;
const {
dataFrameAnalytics: { validateDataFrameAnalytics },
} = useMlApiContext();

const runValidationChecks = async () => {
try {
const analyticsJobConfig = (isAdvancedEditorEnabled
? jobConfig
: getJobConfigFromFormState(form)) as DataFrameAnalyticsConfig;
const validationResults: ValidateAnalyticsJobResponse = await validateDataFrameAnalytics(
analyticsJobConfig
);

const validationSummary = { warning: 0, success: 0 };
validationResults.forEach((message) => {
if (message?.status === VALIDATION_STATUS.WARNING) {
validationSummary.warning++;
} else if (message?.status === VALIDATION_STATUS.SUCCESS) {
validationSummary.success++;
}
});

setValidationMessages(validationResults);
setValidationSummary(validationSummary);
setChecksInProgress(false);
} catch (err) {
setErrorMessage({
heading: i18n.translate(
'xpack.ml.dataframe.analytics.validation.validationFetchErrorMessage',
{
defaultMessage: 'Error validating job',
}
),
id: 'error',
status: VALIDATION_STATUS.ERROR,
text: extractErrorMessage(err),
});
setChecksInProgress(false);
}
};

useEffect(function beginValidationChecks() {
setChecksInProgress(true);
runValidationChecks();
}, []);

if (errorMessage !== undefined) {
validationMessages.push(errorMessage);
}

export const ValidationStep: FC<Props> = ({
checksInProgress,
validationMessages,
setCurrentStep,
}) => {
const callouts = validationMessages.map((m, i) => <Callout key={`${m.id}_${i}`} {...m} />);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,129 @@
* 2.0.
*/

import React, { FC, useState } from 'react';
import React, { FC, useEffect, useMemo, useState } from 'react';
import { EuiForm } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { debounce } from 'lodash';

import { CreateAnalyticsStepProps } from '../../../analytics_management/hooks/use_create_analytics_form';
import { ValidationStep } from './validation_step';
import { ValidationStepDetails } from './validation_step_details';
import { ANALYTICS_STEPS } from '../../page';
import { useMlApiContext } from '../../../../../contexts/kibana';
import { getJobConfigFromFormState } from '../../../analytics_management/hooks/use_create_analytics_form/state';
import { extractErrorMessage } from '../../../../../../../common/util/errors';
import {
CalloutMessage,
ValidateAnalyticsJobResponse,
VALIDATION_STATUS,
} from '../../../../../../../common/constants/validation';

export interface ValidationSummary {
warning: number;
success: number;
}

export const ValidationStepWrapper: FC<CreateAnalyticsStepProps> = ({
actions,
state,
setCurrentStep,
step,
stepActivated,
}) => {
const [validationSummary, setValidationSummary] = useState<ValidationSummary>({
warning: 0,
success: 0,
});

const [checksInProgress, setChecksInProgress] = useState<boolean>(false);
const [validationMessages, setValidationMessages] = useState<CalloutMessage[]>([]);
const [errorMessage, setErrorMessage] = useState<CalloutMessage | undefined>();
const { form, jobConfig, isAdvancedEditorEnabled } = state;
const {
dependentVariable,
jobType,
trainingPercent,
numTopFeatureImportanceValues,
numTopClasses,
includes,
} = form;
const showValidationStep = step === ANALYTICS_STEPS.VALIDATION;
const showDetails = step !== ANALYTICS_STEPS.VALIDATION && stepActivated === true;
const {
dataFrameAnalytics: { validateDataFrameAnalytics },
} = useMlApiContext();

const dataTestSubj = `mlAnalyticsCreateJobWizardValidationStepWrapper${
showValidationStep ? ' active' : ''
}${showDetails ? ' summary' : ''}`;

const debouncedValidationChecks = debounce(async () => {
setChecksInProgress(true);
try {
const analyticsJobConfig = isAdvancedEditorEnabled
? jobConfig
: getJobConfigFromFormState(form);
const validationResults: ValidateAnalyticsJobResponse = await validateDataFrameAnalytics(
analyticsJobConfig
);

setValidationMessages(validationResults);
setErrorMessage(undefined);
setChecksInProgress(false);
} catch (err) {
setErrorMessage({
heading: i18n.translate(
'xpack.ml.dataframe.analytics.validation.validationFetchErrorMessage',
{
defaultMessage: 'Error validating job',
}
),
id: 'error',
status: VALIDATION_STATUS.ERROR,
text: extractErrorMessage(err),
});
setChecksInProgress(false);
}
}, 500);

useEffect(
function beginValidationChecks() {
if (jobType !== undefined && (showValidationStep || stepActivated === true)) {
debouncedValidationChecks();
}
},
[
showValidationStep,
dependentVariable,
trainingPercent,
numTopFeatureImportanceValues,
numTopClasses,
includes,
]
);

if (errorMessage !== undefined) {
validationMessages.push(errorMessage);
}

const validationSummary = useMemo(
() =>
validationMessages.reduce(
(acc, message) => {
if (message?.status === VALIDATION_STATUS.WARNING) {
acc.warning += 1;
} else if (message?.status === VALIDATION_STATUS.SUCCESS) {
acc.success += 1;
}
return acc;
},
{ warning: 0, success: 0 }
),
[validationMessages]
);

return (
<EuiForm className="mlDataFrameAnalyticsCreateForm" data-test-subj={dataTestSubj}>
{showValidationStep && (
<ValidationStep
actions={actions}
state={state}
checksInProgress={checksInProgress}
validationMessages={validationMessages}
setCurrentStep={setCurrentStep}
setValidationSummary={setValidationSummary}
/>
)}
{showDetails && (
Expand Down
Loading

0 comments on commit 89850f2

Please sign in to comment.