kibana/packages
Kibana Machine b58c5a9e3a
[8.x] [Inventory v2] Fix issue with logs only views (#207305) (#207399)
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Inventory v2] Fix issue with logs only views
(#207305)](https://github.com/elastic/kibana/pull/207305)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"dzheni.pavlova@elastic.co"},"sourceCommit":{"committedDate":"2025-01-21T16:29:05Z","message":"[Inventory
v2] Fix issue with logs only views (#207305)\n\nCloses
https://github.com/elastic/kibana/issues/206967\r\n\r\n##
Summary\r\n\r\nAfter some changes related to V2 migration of getting the
entities,\r\nthere was an issue with the new data coming from the
endpoint - the\r\n`data_stream.type` is a string instead of an array in
case of a single\r\ndata stream so this PR adds a fix to support that
(and a test)\r\n\r\n## Bug fixes\r\n- Service overview page loads for a
logs-only data stream\r\n- After adding the fix, I saw another error
related to the `useTheme`\r\nand changed it to use the `euiTheme`
similar to the other changes\r\nrelated to the Borealis team
upgrade\r\n\r\n## Testing\r\nTo test the scenario with services and
hosts coming from logs (without\r\nAPM / metrics) I added a new scenario
in synthtrace so to test then we\r\nshould:\r\n- Run the new scenario:
`node scripts/synthtrace logs_only` (if possible\r\non a clean ES)\r\n-
Enable `observability:entityCentricExperience` in Stack Management
>\r\nAdvanced Setting\r\n- Go to Inventory and click on a service\r\n -
The logs-only views should be available\r\n- Go to Inventory and click
on a host\r\n - The logs-only views should be available\r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cfd5fd40-ac44-4807-9a29-f3ee3015d814\r\n\r\n\r\n
- Test one of the scenarios with mix of APM/metrics/logs\r\n - Run `node
scripts/synthtrace infra_hosts_with_apm_hosts`\r\n- Enable
`observability:entityCentricExperience` in Stack Management
>\r\nAdvanced Setting\r\n - Go to Inventory and click on a service from
APM\r\n - The APM views (service/traces) should be available\r\n - Go to
Inventory and click on a host\r\n - The asset details view should be
available and show metrics\r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/894c7c1a-aaa1-42cb-9dcb-05c9a5ca8177\r\n\r\n\r\n\r\n-
Infrastructure (Inventory/Hosts, etc) and Applications
(Service\r\nInventory/Traces, etc) should load the data for this
scenario and not\r\nfor the logs only (also for an oblt cluster
connection)\r\n \r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4d092cc6-a8ad-4022-b980-b443be09acc9","sha":"bd5e8ca3209886d5d67e5c78eaf9f3a55b6df55a","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"title":"[Inventory
v2] Fix issue with logs only
views","number":207305,"url":"https://github.com/elastic/kibana/pull/207305","mergeCommit":{"message":"[Inventory
v2] Fix issue with logs only views (#207305)\n\nCloses
https://github.com/elastic/kibana/issues/206967\r\n\r\n##
Summary\r\n\r\nAfter some changes related to V2 migration of getting the
entities,\r\nthere was an issue with the new data coming from the
endpoint - the\r\n`data_stream.type` is a string instead of an array in
case of a single\r\ndata stream so this PR adds a fix to support that
(and a test)\r\n\r\n## Bug fixes\r\n- Service overview page loads for a
logs-only data stream\r\n- After adding the fix, I saw another error
related to the `useTheme`\r\nand changed it to use the `euiTheme`
similar to the other changes\r\nrelated to the Borealis team
upgrade\r\n\r\n## Testing\r\nTo test the scenario with services and
hosts coming from logs (without\r\nAPM / metrics) I added a new scenario
in synthtrace so to test then we\r\nshould:\r\n- Run the new scenario:
`node scripts/synthtrace logs_only` (if possible\r\non a clean ES)\r\n-
Enable `observability:entityCentricExperience` in Stack Management
>\r\nAdvanced Setting\r\n- Go to Inventory and click on a service\r\n -
The logs-only views should be available\r\n- Go to Inventory and click
on a host\r\n - The logs-only views should be available\r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cfd5fd40-ac44-4807-9a29-f3ee3015d814\r\n\r\n\r\n
- Test one of the scenarios with mix of APM/metrics/logs\r\n - Run `node
scripts/synthtrace infra_hosts_with_apm_hosts`\r\n- Enable
`observability:entityCentricExperience` in Stack Management
>\r\nAdvanced Setting\r\n - Go to Inventory and click on a service from
APM\r\n - The APM views (service/traces) should be available\r\n - Go to
Inventory and click on a host\r\n - The asset details view should be
available and show metrics\r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/894c7c1a-aaa1-42cb-9dcb-05c9a5ca8177\r\n\r\n\r\n\r\n-
Infrastructure (Inventory/Hosts, etc) and Applications
(Service\r\nInventory/Traces, etc) should load the data for this
scenario and not\r\nfor the logs only (also for an oblt cluster
connection)\r\n \r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4d092cc6-a8ad-4022-b980-b443be09acc9","sha":"bd5e8ca3209886d5d67e5c78eaf9f3a55b6df55a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207305","number":207305,"mergeCommit":{"message":"[Inventory
v2] Fix issue with logs only views (#207305)\n\nCloses
https://github.com/elastic/kibana/issues/206967\r\n\r\n##
Summary\r\n\r\nAfter some changes related to V2 migration of getting the
entities,\r\nthere was an issue with the new data coming from the
endpoint - the\r\n`data_stream.type` is a string instead of an array in
case of a single\r\ndata stream so this PR adds a fix to support that
(and a test)\r\n\r\n## Bug fixes\r\n- Service overview page loads for a
logs-only data stream\r\n- After adding the fix, I saw another error
related to the `useTheme`\r\nand changed it to use the `euiTheme`
similar to the other changes\r\nrelated to the Borealis team
upgrade\r\n\r\n## Testing\r\nTo test the scenario with services and
hosts coming from logs (without\r\nAPM / metrics) I added a new scenario
in synthtrace so to test then we\r\nshould:\r\n- Run the new scenario:
`node scripts/synthtrace logs_only` (if possible\r\non a clean ES)\r\n-
Enable `observability:entityCentricExperience` in Stack Management
>\r\nAdvanced Setting\r\n- Go to Inventory and click on a service\r\n -
The logs-only views should be available\r\n- Go to Inventory and click
on a host\r\n - The logs-only views should be available\r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cfd5fd40-ac44-4807-9a29-f3ee3015d814\r\n\r\n\r\n
- Test one of the scenarios with mix of APM/metrics/logs\r\n - Run `node
scripts/synthtrace infra_hosts_with_apm_hosts`\r\n- Enable
`observability:entityCentricExperience` in Stack Management
>\r\nAdvanced Setting\r\n - Go to Inventory and click on a service from
APM\r\n - The APM views (service/traces) should be available\r\n - Go to
Inventory and click on a host\r\n - The asset details view should be
available and show metrics\r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/894c7c1a-aaa1-42cb-9dcb-05c9a5ca8177\r\n\r\n\r\n\r\n-
Infrastructure (Inventory/Hosts, etc) and Applications
(Service\r\nInventory/Traces, etc) should load the data for this
scenario and not\r\nfor the logs only (also for an oblt cluster
connection)\r\n \r\n
\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4d092cc6-a8ad-4022-b980-b443be09acc9","sha":"bd5e8ca3209886d5d67e5c78eaf9f3a55b6df55a"}}]}]
BACKPORT-->

Co-authored-by: jennypavlova <dzheni.pavlova@elastic.co>
2025-01-21 18:57:13 +00:00
..
core [8.x] SKA: Relocate remaining modules (#206103) (#206471) 2025-01-14 08:56:57 +01:00
kbn-ambient-common-types Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-ambient-ftr-types Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-ambient-storybook-types Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-ambient-ui-types Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-apm-synthtrace [8.x] [Inventory v2] Fix issue with logs only views (#207305) (#207399) 2025-01-21 18:57:13 +00:00
kbn-apm-synthtrace-client [8.x] [APM][Transactions] Test trace summary (#207115) (#207358) 2025-01-21 15:32:26 +00:00
kbn-axe-config Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-babel-preset [8.x] [Security Solution] - remove styled-components and cleanup for timeline header actions (#206694) (#206830) 2025-01-15 13:44:36 -06:00
kbn-babel-register [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-operations (#202739) (#205320) 2024-12-31 19:01:38 +01:00
kbn-babel-transform [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-bazel-runner Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-capture-oas-snapshot-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-check-mappings-update-cli [8.x] Reapply &quot;[Response Ops][Alerting] Backfill actions schema changes for intermediate release (#204657) (#205821) 2025-01-07 23:42:40 +00:00
kbn-check-prod-native-modules-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-ci-stats-core [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-ci-stats-performance-metrics Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-ci-stats-reporter [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-ci-stats-shipper-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-cli-dev-mode [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-presentation (#204843) (#205120) 2024-12-24 08:44:32 +01:00
kbn-code-owners [8.x] [code-owners] Add area information to code owner entries (#205143) (#205147) 2024-12-24 12:11:18 -06:00
kbn-cypress-config [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-dependency-usage [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-security (#202748) (#205569) 2025-01-06 16:48:09 +03:00
kbn-dev-cli-errors [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-dev-cli-runner [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-dev-proc-runner [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-dev-utils [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-docs-utils [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-visualizations (#202754) (#205974) 2025-01-13 10:53:37 +00:00
kbn-es [8.x] Fix build_snapshot for Apple silicon laptops (#204951) (#205750) 2025-01-07 16:01:58 +00:00
kbn-es-archiver [8.x] [ES &#x60;body&#x60; removal] &#x60;@elastic/appex-qa&#x60; (#204878) (#204916) 2024-12-19 06:55:11 -06:00
kbn-eslint-config [8.x] Upgrade EUI to v98.2.1-borealis.1 (#204783) 2025-01-08 09:59:50 +00:00
kbn-eslint-plugin-css [8.x] Resolve false positives with eslint no color rule (#204848) (#204906) 2024-12-19 06:23:17 -06:00
kbn-eslint-plugin-disable [8.x] Add ESLINT constraints to detect inter-group dependencies (#194810) (#197670) 2024-10-24 13:20:30 -07:00
kbn-eslint-plugin-eslint Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-eslint-plugin-i18n [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-visualizations (#202754) (#205974) 2025-01-13 10:53:37 +00:00
kbn-eslint-plugin-imports [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-operations (#202739) (#205320) 2024-12-31 19:01:38 +01:00
kbn-eslint-plugin-telemetry [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/obs-ux-infra_services-team (#202830) (#205231) 2024-12-29 13:10:37 -06:00
kbn-expect [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-failed-test-reporter-cli [8.x] [kbn-scout-reporting] add failed test reporter (#205096) (#206849) 2025-01-17 13:56:18 +00:00
kbn-find-used-node-modules Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-ftr-common-functional-services [8.x] [kbn-test] add forceNewSession option to re-generate session cookie (#199018) (#204583) 2024-12-18 08:43:32 -06:00
kbn-ftr-common-functional-ui-services [8.x] [Data Usage] functional tests (#203166) (#204019) 2024-12-12 09:07:51 -06:00
kbn-ftr-screenshot-filename [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-gen-ai-functional-testing [8.x] Add base FTR test coverage for inference APIs (#198000) (#202916) 2024-12-05 07:03:22 -06:00
kbn-generate [8.x] SKA: Cleanup and follow-up tasks (1 of many) (#206420) (#206656) 2025-01-14 20:02:02 +00:00
kbn-generate-console-definitions [8.x] SKA: Categorise remaining packages (#205875) (#205973) 2025-01-08 23:32:22 +00:00
kbn-get-repo-files [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-import-locator Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-import-resolver [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-io-ts-utils [8.x] [Perfomance] Track time range picker with onPageReady function (#202889) (#204564) 2024-12-17 08:17:58 -06:00
kbn-jest-serializers [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-journeys [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-json-ast Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-kibana-manifest-schema [8.x] Kibana Sustainable Architecture: Force &#x60;visibility: &#x27;private&#x27;&#x60; for solutions in manifest (#199452) (#199488) 2024-11-08 10:26:58 -06:00
kbn-lint-packages-cli [8.x] [codeowners] Filter kibanamachine (#199404) (#199864) 2024-11-12 14:38:18 -06:00
kbn-lint-ts-projects-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-managed-vscode-config Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-managed-vscode-config-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-management [8.x] Sustainable Kibana Architecture: Move the rest of shared-ux modules (#205924) (#206269) 2025-01-10 14:51:47 +00:00
kbn-manifest [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-mock-idp-plugin [8.x] Preparation for High Contrast Mode, Security domains (#202609) (#203493) 2024-12-09 16:43:23 -06:00
kbn-mock-idp-utils [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-openapi-bundler Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-openapi-generator [8.x] SKA: Relocate modules owned by @elastic/security-solution (#204523) 2024-12-17 20:13:10 +01:00
kbn-optimizer [8.x] [controls] lazy load control actions (#206876) (#207277) 2025-01-21 08:37:49 -05:00
kbn-optimizer-webpack-helpers [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-peggy [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-peggy-loader Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-performance-testing-dataset-extractor [8.x] [ES &#x60;body&#x60; removal] &#x60;@elastic/appex-qa&#x60; (#204878) (#204916) 2024-12-19 06:55:11 -06:00
kbn-picomatcher Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-plugin-check [8.x] SKA: Categorise remaining packages (#205875) (#205973) 2025-01-08 23:32:22 +00:00
kbn-plugin-generator [8.x] Sustainable Kibana Architecture: Update tooling to take into account the new folders (#202327) (#202419) 2024-12-02 06:01:43 -06:00
kbn-plugin-helpers [8.x] Sustainable Kibana Architecture: Move CodeEditor related packages #205587 (#205738) (#205919) 2025-01-10 11:20:26 +00:00
kbn-relocate [8.x] SK: Relocate Script v7.2 (#207081) (#207210) 2025-01-20 16:21:55 +00:00
kbn-repo-file-maps Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-repo-linter Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-repo-path [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-repo-source-classifier [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-visualizations (#202754) (#205974) 2025-01-13 10:53:37 +00:00
kbn-repo-source-classifier-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-scout [8.x] [kbn-scout-reporting] add failed test reporter (#205096) (#206849) 2025-01-17 13:56:18 +00:00
kbn-scout-info [8.x] [kbn-scout] Custom event-oriented test reporter & persistence (#202906) (#204696) 2024-12-18 05:06:58 -06:00
kbn-scout-reporting [8.x] [kbn-scout-reporting] add failed test reporter (#205096) (#206849) 2025-01-17 13:56:18 +00:00
kbn-set-map [8.x] SKA: Categorise remaining packages (#205875) (#205973) 2025-01-08 23:32:22 +00:00
kbn-some-dev-log [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-sort-package-json Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-spec-to-console Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-stdio-dev-helpers [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-storybook [8.x] Sustainable Kibana Architecture: Move plugins owned by @elastic/appex-sharedux (#204959) (#205508) 2025-01-05 19:48:48 +00:00
kbn-styled-components-mapping-cli [8.x] Update styled_components_files.js to include all files that import styled-components (#206084) 2025-01-10 22:11:34 +00:00
kbn-telemetry-tools [8.x] Fix telemetry CLI to write empty properties collection (#205746) (#205786) 2025-01-07 18:39:53 +00:00
kbn-test [8.x] [React@18] fix outstanding easy unit tests (#206917) (#207060) 2025-01-17 14:43:41 +00:00
kbn-test-eui-helpers [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-test-jest-helpers [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-test-subj-selector [8.x] [scout] migrate more Discover tests (#201842) (#204748) 2024-12-18 08:50:13 -06:00
kbn-tooling-log [8.x] Sustainable Kibana Architecture: Categorise straightforward packages (#199630) (#201340) 2024-11-22 09:47:23 -06:00
kbn-ts-projects [Backport] Dependency Usage CLI (#201815) 2024-11-26 21:48:26 +01:00
kbn-ts-type-check-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-validate-next-docs-cli [8.x] [ci] Work around docosaurus errors (#206097) (#206150) 2025-01-10 00:31:36 +00:00
kbn-web-worker-stub Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-whereis-pkg-cli Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kbn-yarn-lock-validator Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
serverless/storybook/config [8.x] Sustainable Kibana Architecture: Move the rest of shared-ux modules (#205924) (#206269) 2025-01-10 14:51:47 +00:00
README.md [8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-core (#201653) (#205563) 2025-01-05 16:32:00 +01:00

Kibana-related packages

This folder contains packages that are intended for use in Kibana and Kibana plugins.

tl;dr:

  • Don't publish to npm registry
  • Always use the @kbn namespace
  • Always set "private": true in package.json

Using these packages

We no longer publish these packages to the npm registry. Now, instead of specifying a version when including these packages, we rely on yarn workspaces, which sets up a symlink to the package.

For example if you want to use the @kbn/i18n package in Kibana itself, you can specify the dependency like this:

"@kbn/i18n": "1.0.0"

However, if you want to use this from a Kibana plugin, you need to use a link: dependency and account for the relative location of the Kibana repo, so it would instead be:

"@kbn/i18n": "link:../../kibana/src/platform/packages/shared/kbn-i18n"

then run yarn kbn bootstrap from the plugin directory.

Creating a new package

Run the following command from the root of the Kibana repo:

node scripts/generate package @kbn/<PACKAGE_NAME> --web --owner @elastic/<TEAM_NAME>

Unit tests for a package

Currently there is only one tool being used in order to test packages which is Jest. Below we will explain how it should be done.

Jest

A package should follow the pattern of having .test.js files as siblings of the source code files, and these run by Jest.

A package using the .test.js naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana test script in the root package.json.

  • yarn test runs all unit tests.
  • yarn jest runs all Jest tests in Kibana.

In order for the plugin or package to use Jest, a jest.config.js file must be present in it's root. However, there are safeguards for this in CI should a test file be added without a corresponding config file.


Each package can also specify its own test script in the package's package.json, for cases where you'd prefer to run the tests from the local package directory.