Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Move aiops-utils package to x-pack/packages/ml. #134985

Merged
merged 7 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@
/x-pack/test/functional/services/transform/ @elastic/ml-ui
/x-pack/test/functional_basic/apps/transform/ @elastic/ml-ui
/x-pack/packages/ml/ @elastic/ml-ui
/packages/kbn-aiops-utils @elastic/ml-ui
/examples/response_stream/ @elastic/ml-ui

# Maps
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"@hapi/inert": "^6.0.4",
"@hapi/wreck": "^17.1.0",
"@kbn/ace": "link:bazel-bin/packages/kbn-ace",
"@kbn/aiops-utils": "link:bazel-bin/packages/kbn-aiops-utils",
"@kbn/aiops-utils": "link:bazel-bin/x-pack/packages/ml/aiops_utils",
"@kbn/alerts": "link:bazel-bin/packages/kbn-alerts",
"@kbn/ambient-storybook-types": "link:bazel-bin/packages/kbn-ambient-storybook-types",
"@kbn/ambient-ui-types": "link:bazel-bin/packages/kbn-ambient-ui-types",
Expand Down Expand Up @@ -664,7 +664,7 @@
"@types/json-stable-stringify": "^1.0.32",
"@types/json5": "^0.0.30",
"@types/kbn__ace": "link:bazel-bin/packages/kbn-ace/npm_module_types",
"@types/kbn__aiops-utils": "link:bazel-bin/packages/kbn-aiops-utils/npm_module_types",
"@types/kbn__aiops-utils": "link:bazel-bin/x-pack/packages/ml/aiops_utils/npm_module_types",
"@types/kbn__alerts": "link:bazel-bin/packages/kbn-alerts/npm_module_types",
"@types/kbn__analytics": "link:bazel-bin/packages/kbn-analytics/npm_module_types",
"@types/kbn__analytics-client": "link:bazel-bin/packages/analytics/client/npm_module_types",
Expand Down
4 changes: 2 additions & 2 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ filegroup(
"//packages/elastic-apm-synthtrace:build",
"//packages/elastic-safer-lodash-set:build",
"//packages/kbn-ace:build",
"//packages/kbn-aiops-utils:build",
"//packages/kbn-alerts:build",
"//packages/kbn-ambient-storybook-types:build",
"//packages/kbn-ambient-ui-types:build",
Expand Down Expand Up @@ -163,6 +162,7 @@ filegroup(
"//packages/shared-ux/page/kibana_no_data:build",
"//packages/shared-ux/prompt/no_data_views:build",
"//x-pack/packages/ml/agg_utils:build",
"//x-pack/packages/ml/aiops_utils:build",
"//x-pack/packages/ml/is_populated_object:build",
"//x-pack/packages/ml/string_hash:build",
],
Expand Down Expand Up @@ -215,7 +215,6 @@ filegroup(
"//packages/elastic-apm-synthtrace:build_types",
"//packages/elastic-safer-lodash-set:build_types",
"//packages/kbn-ace:build_types",
"//packages/kbn-aiops-utils:build_types",
"//packages/kbn-alerts:build_types",
"//packages/kbn-analytics:build_types",
"//packages/kbn-apm-config-loader:build_types",
Expand Down Expand Up @@ -311,6 +310,7 @@ filegroup(
"//packages/shared-ux/page/kibana_no_data:build_types",
"//packages/shared-ux/prompt/no_data_views:build_types",
"//x-pack/packages/ml/agg_utils:build_types",
"//x-pack/packages/ml/aiops_utils:build_types",
"//x-pack/packages/ml/is_populated_object:build_types",
"//x-pack/packages/ml/string_hash:build_types",
],
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-aiops-utils/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions packages/kbn-aiops-utils/jest.config.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ function getTsProject(repoPath: string) {
skipAddingFilesFromTsConfig: true,
});
project.addSourceFilesAtPaths([`${repoPath}/x-pack/plugins/**/*.ts`, '!**/*.d.ts']);
project.addSourceFilesAtPaths([`${repoPath}/x-pack/packages/**/*.ts`, '!**/*.d.ts']);
project.addSourceFilesAtPaths([`${repoPath}/src/plugins/**/*.ts`, '!**/*.d.ts']);
project.addSourceFilesAtPaths([`${repoPath}/packages/**/*.ts`, '!**/*.d.ts']);
project.resolveSourceFileDependencies();
Expand Down
13 changes: 10 additions & 3 deletions packages/kbn-docs-utils/src/api_docs/find_plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function findPlugins(): PluginOrPackage[] {
*/
export function findPackages(): PluginOrPackage[] {
const packagePaths = globby
.sync(Path.resolve(REPO_ROOT, 'packages/**/package.json'), { absolute: true })
.sync(Path.resolve(REPO_ROOT, '{x-pack/,}packages/**/package.json'), { absolute: true })
.map((path) =>
// absolute paths returned from globby are using normalize or
// something so the path separators are `/` even on windows,
Expand All @@ -59,15 +59,22 @@ export function findPackages(): PluginOrPackage[] {
scope = ApiScope.CLIENT;
}

let ownerName = '[Owner missing]';
// Some of these author fields have "<[email protected]>" in the name which mdx chokes on. Removing the < and > seems to work.
if (Array.isArray(manifest.author)) {
ownerName = manifest.author.map((d) => d.replace(/[<>]/gi, '')).join(', ');
} else if (typeof manifest.author === 'string') {
ownerName = manifest.author.replace(/[<>]/gi, '');
}

acc.push({
directory: Path.dirname(path),
manifestPath: path,
manifest: {
...manifest,
id: manifest.name,
serviceFolders: [],
// Some of these author fields have "<[email protected]>" in the name which mdx chokes on. Removing the < and > seems to work.
owner: { name: manifest.author?.replace(/[<>]/gi, '') || '[Owner missing]' },
owner: { name: ownerName },
},
isPlugin: false,
scope,
Expand Down
31 changes: 2 additions & 29 deletions x-pack/packages/ml/agg_utils/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
# @kbn/ml-agg-utils

This package includes utility functions provided by the ML team to be used in Kibana plugins related to data manipulation and verification.
This package includes utility functions related to creating elasticsearch aggregation queries, data manipulation and verification.

<!-- INSERT GENERATED DOCS START -->

### `buildSamplerAggregation` (function)

Wraps the supplied aggregations in a sampler aggregation.
A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
of less than 1 indicates no sampling, and the aggs are returned as-is.

**Parameters:**

- aggs (`any`)
- samplerShardSize (`number`)

**returns:** Record<string, AggregationsAggregationContainer>

### `getSamplerAggregationsResponsePath` (function)

**Parameters:**

- samplerShardSize (`number`)

**returns:** string[]

### `getAggIntervals` (function)

Returns aggregation intervals for the supplied document fields.

<!-- INSERT GENERATED DOCS END -->
https://docs.elastic.dev/kibana-dev-docs/api/kbn-ml-agg-utils
11 changes: 4 additions & 7 deletions x-pack/packages/ml/agg_utils/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"name": "@kbn/ml-agg-utils",
"description": "This package includes utility functions related to creating elasticsearch aggregation queries, data manipulation and verification.",
"author": "Machine Learning UI",
"homepage": "https://docs.elastic.dev/kibana-dev-docs/api/kbn-ml-agg-utils",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0",
"devDependencies": {
"ts-readme": "^1.1.3"
},
"scripts": {
"generate-docs": "ts-readme src/index.ts"
}
"license": "SSPL-1.0 OR Elastic License 2.0"
}
Loading