Skip to content

Commit

Permalink
Merge branch 'main' into serverless-role-selector-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jan 5, 2024
2 parents 6f6b5af + 59d720e commit e4c508d
Show file tree
Hide file tree
Showing 380 changed files with 4,056 additions and 1,104 deletions.
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ x-pack/test/cloud_integration/plugins/saml_provider @elastic/kibana-core
x-pack/plugins/cloud_integrations/cloud_links @elastic/kibana-core
x-pack/plugins/cloud @elastic/kibana-core
x-pack/plugins/cloud_security_posture @elastic/kibana-cloud-security-posture
packages/shared-ux/code_editor @elastic/appex-sharedux
packages/shared-ux/code_editor/impl @elastic/appex-sharedux
packages/shared-ux/code_editor/mocks @elastic/appex-sharedux
packages/kbn-code-owners @elastic/appex-qa
packages/kbn-coloring @elastic/kibana-visualizations
packages/kbn-config @elastic/kibana-core
Expand Down Expand Up @@ -487,6 +488,7 @@ x-pack/plugins/kubernetes_security @elastic/kibana-cloud-security-posture
packages/kbn-language-documentation-popover @elastic/kibana-visualizations
packages/kbn-lens-embeddable-utils @elastic/obs-ux-infra_services-team @elastic/kibana-visualizations
packages/kbn-lens-formula-docs @elastic/kibana-visualizations
x-pack/examples/lens_embeddable_inline_editing_example @elastic/kibana-visualizations
x-pack/plugins/lens @elastic/kibana-visualizations
x-pack/plugins/license_api_guard @elastic/platform-deployment-management
x-pack/plugins/license_management @elastic/platform-deployment-management
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import React from 'react';
import { CodeEditor } from '@kbn/kibana-react-plugin/public';
import { CodeEditor } from '@kbn/code-editor';

interface Props {
value: string;
Expand Down
1 change: 1 addition & 0 deletions examples/expressions_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"@kbn/i18n",
"@kbn/i18n-react",
"@kbn/core-ui-settings-browser",
"@kbn/code-editor",
]
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@
"@kbn/cloud-links-plugin": "link:x-pack/plugins/cloud_integrations/cloud_links",
"@kbn/cloud-plugin": "link:x-pack/plugins/cloud",
"@kbn/cloud-security-posture-plugin": "link:x-pack/plugins/cloud_security_posture",
"@kbn/code-editor": "link:packages/shared-ux/code_editor",
"@kbn/code-editor": "link:packages/shared-ux/code_editor/impl",
"@kbn/code-editor-mock": "link:packages/shared-ux/code_editor/mocks",
"@kbn/coloring": "link:packages/kbn-coloring",
"@kbn/config": "link:packages/kbn-config",
"@kbn/config-mocks": "link:packages/kbn-config-mocks",
Expand Down Expand Up @@ -509,6 +510,7 @@
"@kbn/language-documentation-popover": "link:packages/kbn-language-documentation-popover",
"@kbn/lens-embeddable-utils": "link:packages/kbn-lens-embeddable-utils",
"@kbn/lens-formula-docs": "link:packages/kbn-lens-formula-docs",
"@kbn/lens-inline-editing-example-plugin": "link:x-pack/examples/lens_embeddable_inline_editing_example",
"@kbn/lens-plugin": "link:x-pack/plugins/lens",
"@kbn/license-api-guard-plugin": "link:x-pack/plugins/license_api_guard",
"@kbn/license-management-plugin": "link:x-pack/plugins/license_management",
Expand Down Expand Up @@ -1307,6 +1309,7 @@
"@octokit/rest": "^16.35.0",
"@openpgp/web-stream-tools": "^0.0.10",
"@parcel/watcher": "^2.1.0",
"@redocly/cli": "^1.6.0",
"@storybook/addon-a11y": "^6.5.16",
"@storybook/addon-actions": "^6.5.16",
"@storybook/addon-controls": "^6.5.16",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,33 +133,36 @@ describe('findActiveNodes', () => {
title: 'Root',
path: 'root',
},
// Group 1
'[0][0]': {
id: 'group1',
title: 'Group 1',
deepLink: getDeepLink('group1', 'group1'),
path: 'root.group1',
},
'[0][0][0]': {
id: 'group1A',
title: 'Group 1A',
path: 'root.group1.group1A',
},
'[0][0][0][0]': {
id: 'item1',
title: 'Item 1',
deepLink: getDeepLink('item1', 'item1'),
path: 'root.group1.group1A.item1',
deepLink: getDeepLink('item1', 'item1'), // First match
path: 'root.group1.item1',
},
// Group 2
'[0][1]': {
id: 'group2',
title: 'Group 2',
deepLink: getDeepLink('group2', 'group2'),
path: 'root.group2',
},
'[0][1][0]': {
id: 'group2A',
title: 'Group 2A',
path: 'root.group2.group2A',
},
'[0][1][0][0]': {
id: 'item2',
title: 'Item 2',
deepLink: getDeepLink('item1', 'item1'), // Same link as above, should match both
path: 'root.group2.item2',
// Second match --> should come first as it is the longest match of the 2
deepLink: getDeepLink('item1', 'item1'),
path: 'root.group2.group2A.item2',
},
};

Expand All @@ -172,21 +175,21 @@ describe('findActiveNodes', () => {
path: 'root',
},
{
id: 'group1',
title: 'Group 1',
deepLink: getDeepLink('group1', 'group1'),
path: 'root.group1',
id: 'group2',
title: 'Group 2',
deepLink: getDeepLink('group2', 'group2'),
path: 'root.group2',
},
{
id: 'group1A',
title: 'Group 1A',
path: 'root.group1.group1A',
id: 'group2A',
title: 'Group 2A',
path: 'root.group2.group2A',
},
{
id: 'item1',
title: 'Item 1',
id: 'item2',
title: 'Item 2',
deepLink: getDeepLink('item1', 'item1'),
path: 'root.group1.group1A.item1',
path: 'root.group2.group2A.item2',
},
],
[
Expand All @@ -196,15 +199,15 @@ describe('findActiveNodes', () => {
path: 'root',
},
{
id: 'group2',
title: 'Group 2',
path: 'root.group2',
id: 'group1',
title: 'Group 1',
path: 'root.group1',
},
{
id: 'item2',
title: 'Item 2',
id: 'item1',
title: 'Item 1',
deepLink: getDeepLink('item1', 'item1'),
path: 'root.group2.item2',
path: 'root.group1.item1',
},
],
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ export const findActiveNodes = (
matches[length] = [];
}
matches[length].push(key);
// If there are multiple node matches of the same URL path length, we want to order them by
// tree depth, so that the longest match (deepest node) comes first.
matches[length].sort((a, b) => b.length - a.length);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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 { ApmFields, Instance } from '@kbn/apm-synthtrace-client';
import { service } from '@kbn/apm-synthtrace-client/src/lib/apm/service';
import { Scenario } from '../cli/scenario';
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
import { getSynthtraceEnvironment } from '../lib/utils/get_synthtrace_environment';
import { withClient } from '../lib/utils/with_client';

const ENVIRONMENT = getSynthtraceEnvironment(__filename);
const MAX_DEPENDENCIES = 10000;
const MAX_DEPENDENCIES_PER_SERVICE = 500;
const MAX_SERVICES = 20;

const scenario: Scenario<ApmFields> = async (runOptions: RunOptions) => {
return {
generate: ({ range, clients: { apmEsClient } }) => {
const javaInstances = Array.from({ length: MAX_SERVICES }).map((_, index) =>
service(`opbeans-java-${index}`, ENVIRONMENT, 'java').instance(`java-instance-${index}`)
);

const instanceDependencies = (instance: Instance, startIndex: number) => {
const rate = range.ratePerMinute(60);

return rate.generator((timestamp, index) => {
const currentIndex = index % MAX_DEPENDENCIES_PER_SERVICE;
const destination = (startIndex + currentIndex) % MAX_DEPENDENCIES;

const span = instance
.transaction({ transactionName: 'GET /java' })
.timestamp(timestamp)
.duration(400)
.success()
.children(
instance
.span({
spanName: 'GET apm-*/_search',
spanType: 'db',
spanSubtype: 'elasticsearch',
})
.destination(`elasticsearch/${destination}`)
.timestamp(timestamp)
.duration(200)
.success()
);

return span;
});
};

return withClient(
apmEsClient,
javaInstances.map((instance, index) =>
instanceDependencies(instance, (index * MAX_DEPENDENCIES_PER_SERVICE) % MAX_DEPENDENCIES)
)
);
},
};
};

export default scenario;
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,13 @@ describe('lens_attributes_builder', () => {
formulaAPI,
});
const builder = new LensAttributesBuilder({ visualization: metriChart });

const {
state: {
datasourceStates: {
formBased: { layers },
},
visualization,
},
state: { datasourceStates: datasourceStates, visualization },
} = builder.build();

const layers = datasourceStates.formBased?.layers;

expect(layers).toEqual({
layer: {
columnOrder: ['metric_formula_accessor'],
Expand Down Expand Up @@ -156,14 +154,11 @@ describe('lens_attributes_builder', () => {
});
const builder = new LensAttributesBuilder({ visualization: metriChart });
const {
state: {
datasourceStates: {
formBased: { layers },
},
visualization,
},
state: { datasourceStates: datasourceStates, visualization },
} = builder.build();

const layers = datasourceStates.formBased?.layers;

expect(layers).toEqual({
layer: {
columnOrder: ['metric_formula_accessor'],
Expand Down Expand Up @@ -215,14 +210,11 @@ describe('lens_attributes_builder', () => {
});
const builder = new LensAttributesBuilder({ visualization: xyChart });
const {
state: {
datasourceStates: {
formBased: { layers },
},
visualization,
},
state: { datasourceStates: datasourceStates, visualization },
} = builder.build();

const layers = datasourceStates.formBased?.layers;

expect(layers).toEqual({
layer_0: {
columnOrder: ['x_date_histogram', 'formula_accessor_0_0'],
Expand Down Expand Up @@ -272,14 +264,11 @@ describe('lens_attributes_builder', () => {
});
const builder = new LensAttributesBuilder({ visualization: xyChart });
const {
state: {
datasourceStates: {
formBased: { layers },
},
visualization,
},
state: { datasourceStates: datasourceStates, visualization },
} = builder.build();

const layers = datasourceStates.formBased?.layers;

expect(layers).toEqual({
layer_0: {
columnOrder: ['x_date_histogram', 'formula_accessor_0_0'],
Expand Down Expand Up @@ -340,14 +329,11 @@ describe('lens_attributes_builder', () => {
});
const builder = new LensAttributesBuilder({ visualization: xyChart });
const {
state: {
datasourceStates: {
formBased: { layers },
},
visualization,
},
state: { datasourceStates: datasourceStates, visualization },
} = builder.build();

const layers = datasourceStates.formBased?.layers;

expect(layers).toEqual({
layer_0: {
columnOrder: ['x_date_histogram', 'formula_accessor_0_0', 'formula_accessor_0_1'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ test('generates gauge chart config', async () => {
"test": Object {},
},
"datasourceStates": Object {
"formBased": Object {
"layers": Object {},
},
"textBased": Object {
"layers": Object {
"layer_0": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ test('generates metric chart config', async () => {
"test": Object {},
},
"datasourceStates": Object {
"formBased": Object {
"layers": Object {},
},
"textBased": Object {
"layers": Object {
"layer_0": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ test('generates metric chart config', async () => {
"test": Object {},
},
"datasourceStates": Object {
"formBased": Object {
"layers": Object {},
},
"textBased": Object {
"layers": Object {
"layer_0": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ test('generates metric chart config', async () => {
"test": Object {},
},
"datasourceStates": Object {
"formBased": Object {
"layers": Object {},
},
"textBased": Object {
"layers": Object {
"layer_0": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ test('generates metric chart config', async () => {
"test": Object {},
},
"datasourceStates": Object {
"formBased": Object {
"layers": Object {},
},
"textBased": Object {
"layers": Object {
"layer_0": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ test('generates metric chart config', async () => {
"test": Object {},
},
"datasourceStates": Object {
"formBased": Object {
"layers": Object {},
},
"textBased": Object {
"layers": Object {
"layer_0": Object {
Expand Down
Loading

0 comments on commit e4c508d

Please sign in to comment.