Skip to content

Commit

Permalink
Merge branch 'main' into ftr/split-common-config.group2
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko authored Oct 6, 2023
2 parents 9cb3e3a + feadfa5 commit 30db781
Show file tree
Hide file tree
Showing 24 changed files with 182 additions and 71 deletions.
36 changes: 36 additions & 0 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

Review important information about the {kib} 8.x releases.

* <<release-notes-8.10.3>>
* <<release-notes-8.10.2>>
* <<release-notes-8.10.1>>
* <<release-notes-8.10.0>>
Expand Down Expand Up @@ -50,6 +51,41 @@ Review important information about the {kib} 8.x releases.
* <<release-notes-8.0.0-alpha1>>

--
[[release-notes-8.10.3]]
== {kib} 8.10.3

The 8.10.3 release includes the following bug fixes.

[float]
[[enhancement-v8.10.3]]
=== Enhancements
Elastic Security::
For the Elastic Security 8.10.3 release information, refer to {security-guide}/release-notes.html[_Elastic Security Solution Release Notes_].

[float]
[[fixes-v8.10.3]]
=== Bug Fixes
Dashboard::
* Fixes an error the panel descriptions weren't retrieved from the right method ({kibana-pull}166825[#166825]).
Discover::
* Soften saved search content management response `sort` schema ({kibana-pull}166886[#166886]).
Elastic Security::
For the Elastic Security 8.10.3 release information, refer to {security-guide}/release-notes.html[_Elastic Security Solution Release Notes_].
Enterprise Search::
For the Elastic Enterprise Search 8.10.3 release information, refer to {enterprise-search-ref}/changelog.html[_Elastic Enterprise Search Documentation Release notes_].
Fleet::
* Fixes incorrect index template used from the data stream name ({kibana-pull}166941[#166941]).
* Increase package install max timeout limit and add concurrency control to rollovers ({kibana-pull}166775[#166775]).
* Fixes bulk action dropdown ({kibana-pull}166475[#166475]).
Machine Learning::
* AIOps: Fixes render loop when using a saved search ({kibana-pull}166934[#166934]).
Monitoring::
* Convert node roles into array ({kibana-pull}167628[#167628]).
Observability::
* Fixes a set up process error in Universal Profiling ({kibana-pull}167068[#167068]).
Uptime::
* Fixes an error when updating browser monitor in a project ({kibana-pull}168064[#168064]).

[[release-notes-8.10.2]]
== {kib} 8.10.2

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@
"xterm": "^5.1.0",
"yauzl": "^2.10.0",
"yazl": "^2.5.1",
"zod": "^3.21.4"
"zod": "^3.22.3"
},
"devDependencies": {
"@apidevtools/swagger-parser": "^10.0.3",
Expand Down
19 changes: 18 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,23 @@
],
"enabled": true
},
{
"groupName": "security solution modules",
"matchPackageNames": [
"zod",
"langchain"
],
"reviewers": [
"Team: SecuritySolution"
],
"matchBaseBranches": [
"main"
],
"labels": [
"Team: SecuritySolution"
],
"enabled": true
},
{
"groupName": "platform security modules",
"matchPackageNames": [
Expand Down Expand Up @@ -609,4 +626,4 @@
"enabled": true
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const ELASTIC_MODEL_DEFINITIONS: Record<string, ModelDefinition> = Object
},
},
description: i18n.translate('xpack.ml.trainedModels.modelsList.elserV2Description', {
defaultMessage: 'Elastic Learned Sparse EncodeR v2 (Tech Preview)',
defaultMessage: 'Elastic Learned Sparse EncodeR v2',
}),
},
'.elser_model_2_linux-x86_64': {
Expand All @@ -86,8 +86,7 @@ export const ELASTIC_MODEL_DEFINITIONS: Record<string, ModelDefinition> = Object
},
},
description: i18n.translate('xpack.ml.trainedModels.modelsList.elserV2x86Description', {
defaultMessage:
'Elastic Learned Sparse EncodeR v2, optimized for linux-x86_64 (Tech Preview)',
defaultMessage: 'Elastic Learned Sparse EncodeR v2, optimized for linux-x86_64',
}),
},
} as const);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ let logger: ReturnType<typeof loggingSystemMock['createLogger']>;

describe('setAlertsToUntracked()', () => {
beforeEach(() => {
jest.useFakeTimers();
const date = '2023-03-28T22:27:28.159Z';
jest.setSystemTime(new Date(date));

logger = loggingSystemMock.createLogger();
clusterClient = elasticsearchServiceMock.createClusterClient().asInternalUser;
clusterClient.search.mockResponse({
Expand All @@ -32,6 +36,11 @@ describe('setAlertsToUntracked()', () => {
},
});
});

afterAll(() => {
jest.useRealTimers();
});

test('should call updateByQuery on provided ruleIds', async () => {
await setAlertsToUntracked({
logger,
Expand Down Expand Up @@ -83,8 +92,12 @@ describe('setAlertsToUntracked()', () => {
"source": "
if (!ctx._source.containsKey('kibana.alert.status') || ctx._source['kibana.alert.status'].empty) {
ctx._source.kibana.alert.status = 'untracked';
ctx._source.kibana.alert.end = '2023-03-28T22:27:28.159Z';
ctx._source.kibana.alert.time_range.lte = '2023-03-28T22:27:28.159Z';
} else {
ctx._source['kibana.alert.status'] = 'untracked'
ctx._source['kibana.alert.status'] = 'untracked';
ctx._source['kibana.alert.end'] = '2023-03-28T22:27:28.159Z';
ctx._source['kibana.alert.time_range'].lte = '2023-03-28T22:27:28.159Z';
}",
},
},
Expand Down Expand Up @@ -147,8 +160,12 @@ describe('setAlertsToUntracked()', () => {
"source": "
if (!ctx._source.containsKey('kibana.alert.status') || ctx._source['kibana.alert.status'].empty) {
ctx._source.kibana.alert.status = 'untracked';
ctx._source.kibana.alert.end = '2023-03-28T22:27:28.159Z';
ctx._source.kibana.alert.time_range.lte = '2023-03-28T22:27:28.159Z';
} else {
ctx._source['kibana.alert.status'] = 'untracked'
ctx._source['kibana.alert.status'] = 'untracked';
ctx._source['kibana.alert.end'] = '2023-03-28T22:27:28.159Z';
ctx._source['kibana.alert.time_range'].lte = '2023-03-28T22:27:28.159Z';
}",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import { isEmpty } from 'lodash';
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import { Logger } from '@kbn/logging';
import {
ALERT_END,
ALERT_RULE_CONSUMER,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
ALERT_STATUS,
ALERT_STATUS_ACTIVE,
ALERT_STATUS_UNTRACKED,
ALERT_TIME_RANGE,
ALERT_UUID,
} from '@kbn/rule-data-utils';

Expand Down Expand Up @@ -134,7 +136,7 @@ export async function setAlertsToUntracked({
body: {
conflicts: 'proceed',
script: {
source: UNTRACK_UPDATE_PAINLESS_SCRIPT,
source: getUntrackUpdatePainlessScript(new Date()),
lang: 'painless',
},
query: {
Expand Down Expand Up @@ -183,9 +185,13 @@ export async function setAlertsToUntracked({
}

// Certain rule types don't flatten their AAD values, apply the ALERT_STATUS key to them directly
const UNTRACK_UPDATE_PAINLESS_SCRIPT = `
const getUntrackUpdatePainlessScript = (now: Date) => `
if (!ctx._source.containsKey('${ALERT_STATUS}') || ctx._source['${ALERT_STATUS}'].empty) {
ctx._source.${ALERT_STATUS} = '${ALERT_STATUS_UNTRACKED}';
ctx._source.${ALERT_END} = '${now.toISOString()}';
ctx._source.${ALERT_TIME_RANGE}.lte = '${now.toISOString()}';
} else {
ctx._source['${ALERT_STATUS}'] = '${ALERT_STATUS_UNTRACKED}'
ctx._source['${ALERT_STATUS}'] = '${ALERT_STATUS_UNTRACKED}';
ctx._source['${ALERT_END}'] = '${now.toISOString()}';
ctx._source['${ALERT_TIME_RANGE}'].lte = '${now.toISOString()}';
}`;
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { JobId } from '../../../common/types/anomaly_detection_jobs';
import { getDefaultExplorerChartsPanelTitle } from '../../embeddables/anomaly_charts/anomaly_charts_embeddable';
import { MAX_ANOMALY_CHARTS_ALLOWED } from '../../embeddables/anomaly_charts/anomaly_charts_initializer';
import { useAnomalyExplorerContext } from './anomaly_explorer_context';
import { escapeKueryForFieldValuePair } from '../util/string_utils';
import { escapeKueryForEmbeddableFieldValuePair } from '../util/string_utils';
import { useCasesModal } from '../contexts/kibana/use_cases_modal';
import { DEFAULT_MAX_SERIES_TO_PLOT } from '../services/anomaly_explorer_charts_service';
import {
Expand Down Expand Up @@ -154,7 +154,7 @@ export const AnomalyContextMenu: FC<AnomalyContextMenuProps> = ({
const influencers = selectionInfluencers ?? [];
const config = getDefaultEmbeddablePanelConfig(jobIds, queryString);
const queryFromSelectedCells = influencers
.map((s) => escapeKueryForFieldValuePair(s.fieldName, s.fieldValue))
.map((s) => escapeKueryForEmbeddableFieldValuePair(s.fieldName, s.fieldValue))
.join(' or ');

// When adding anomaly charts to Dashboard, we want to respect the Dashboard's time range
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
type ModelState,
} from '@kbn/ml-trained-models-utils';
import { isDefined } from '@kbn/ml-is-defined';
import { css } from '@emotion/react';
import { useStorage } from '@kbn/ml-local-storage';
import { getModelStateColor } from './get_model_state_color';
import { ML_ELSER_CALLOUT_DISMISSED } from '../../../common/types/storage';
Expand Down Expand Up @@ -456,7 +455,7 @@ export const ModelsList: FC<Props> = ({
},
{
name: modelIdColumnName,
width: '15%',
width: '215px',
sortable: ({ model_id: modelId }: ModelItem) => modelId,
truncateText: false,
textOnly: false,
Expand All @@ -477,40 +476,36 @@ export const ModelsList: FC<Props> = ({
},
},
{
width: '35%',
width: '300px',
name: i18n.translate('xpack.ml.trainedModels.modelsList.modelDescriptionHeader', {
defaultMessage: 'Description',
}),
truncateText: false,
'data-test-subj': 'mlModelsTableColumnDescription',
render: ({ description, recommended }: ModelItem) => {
if (!description) return null;
return (
<>
{description.replace('(Tech Preview)', '')}
{recommended ? (
<EuiToolTip
content={
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.recommendedDownloadContent"
defaultMessage="Recommended ELSER model version for your cluster's hardware configuration"
/>
}
>
<b
css={css`
text-wrap: nowrap;
`}
>
&nbsp;
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.recommendedDownloadLabel"
defaultMessage="(Recommended)"
/>
</b>
</EuiToolTip>
) : null}
</>
const descriptionText = description.replace('(Tech Preview)', '');
return recommended ? (
<EuiToolTip
content={
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.recommendedDownloadContent"
defaultMessage="Recommended ELSER model version for your cluster's hardware configuration"
/>
}
>
<>
{descriptionText}&nbsp;
<b>
<FormattedMessage
id="xpack.ml.trainedModels.modelsList.recommendedDownloadLabel"
defaultMessage="(Recommended)"
/>
</b>
</>
</EuiToolTip>
) : (
descriptionText
);
},
},
Expand All @@ -534,6 +529,7 @@ export const ModelsList: FC<Props> = ({
</EuiFlexGroup>
),
'data-test-subj': 'mlModelsTableColumnType',
width: '130px',
},
{
field: 'state',
Expand All @@ -551,6 +547,7 @@ export const ModelsList: FC<Props> = ({
) : null;
},
'data-test-subj': 'mlModelsTableColumnDeploymentState',
width: '130px',
},
{
field: ModelsTableToConfigMapping.createdAt,
Expand All @@ -561,8 +558,10 @@ export const ModelsList: FC<Props> = ({
render: (v: number) => dateFormatter(v),
sortable: true,
'data-test-subj': 'mlModelsTableColumnCreatedAt',
width: '210px',
},
{
width: '150px',
name: i18n.translate('xpack.ml.trainedModels.modelsList.actionsHeader', {
defaultMessage: 'Actions',
}),
Expand Down Expand Up @@ -696,12 +695,13 @@ export const ModelsList: FC<Props> = ({
<EuiSpacer size="m" />
<div data-test-subj="mlModelsTableContainer">
<EuiInMemoryTable<ModelItem>
css={{ overflowX: 'auto' }}
isSelectable={true}
isExpandable={true}
hasActions={true}
allowNeutralSort={false}
columns={columns}
hasActions={true}
isExpandable={true}
itemIdToExpandedRowMap={itemIdToExpandedRowMap}
isSelectable={false}
items={items}
itemId={ModelsTableToConfigMapping.id}
loading={isLoading}
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/ml/public/application/util/string_utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
toLocaleString,
mlEscape,
escapeForElasticsearchQuery,
escapeKueryForEmbeddableFieldValuePair,
} from './string_utils';

describe('ML - string utils', () => {
Expand Down Expand Up @@ -160,4 +161,13 @@ describe('ML - string utils', () => {
expect(escapeForElasticsearchQuery('foo/bar')).toBe('foo\\/bar');
});
});
describe('escapeKueryForEmbeddableFieldValuePair', () => {
test('should return correct escaping of kuery values', () => {
expect(escapeKueryForEmbeddableFieldValuePair('fieldName', '')).toBe('fieldName:""');
expect(escapeKueryForEmbeddableFieldValuePair('', 'fieldValue')).toBe('"":fieldValue');
expect(escapeKueryForEmbeddableFieldValuePair('@#specialCharsName%', '<>:;[})')).toBe(
'@#specialCharsName%:\\<\\>\\:;[}\\)'
);
});
});
});
20 changes: 20 additions & 0 deletions x-pack/plugins/ml/public/application/util/string_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,26 @@ export function escapeKueryForFieldValuePair(
return `${escapeKuery(name)}:${escapeKuery(value.toString())}`;
}

const replaceEmptyStringWithQuotation = (s: string) => (s === '' ? '""' : s);

/**
*
* Helper function to returns escaped combined field name and value
* which also replaces empty str with " to ensure compatability with kql queries
* @param name fieldName of selection
* @param value fieldValue of selection
* @returns {string} escaped `name:value` compatible with embeddable input
*/
export function escapeKueryForEmbeddableFieldValuePair(
name: string,
value: string | number | boolean | undefined
): string {
if (!isDefined(name) || !isDefined(value)) return '';
return `${replaceEmptyStringWithQuotation(escapeKuery(name))}:${replaceEmptyStringWithQuotation(
escapeKuery(value.toString())
)}`;
}

export function calculateTextWidth(txt: string | number, isNumber: boolean) {
txt = isNumber && typeof txt === 'number' ? d3.format(',')(txt) : txt;

Expand Down
Loading

0 comments on commit 30db781

Please sign in to comment.