# 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> |
||
---|---|---|
.. | ||
core | ||
kbn-ambient-common-types | ||
kbn-ambient-ftr-types | ||
kbn-ambient-storybook-types | ||
kbn-ambient-ui-types | ||
kbn-apm-synthtrace | ||
kbn-apm-synthtrace-client | ||
kbn-axe-config | ||
kbn-babel-preset | ||
kbn-babel-register | ||
kbn-babel-transform | ||
kbn-bazel-runner | ||
kbn-capture-oas-snapshot-cli | ||
kbn-check-mappings-update-cli | ||
kbn-check-prod-native-modules-cli | ||
kbn-ci-stats-core | ||
kbn-ci-stats-performance-metrics | ||
kbn-ci-stats-reporter | ||
kbn-ci-stats-shipper-cli | ||
kbn-cli-dev-mode | ||
kbn-code-owners | ||
kbn-cypress-config | ||
kbn-dependency-usage | ||
kbn-dev-cli-errors | ||
kbn-dev-cli-runner | ||
kbn-dev-proc-runner | ||
kbn-dev-utils | ||
kbn-docs-utils | ||
kbn-es | ||
kbn-es-archiver | ||
kbn-eslint-config | ||
kbn-eslint-plugin-css | ||
kbn-eslint-plugin-disable | ||
kbn-eslint-plugin-eslint | ||
kbn-eslint-plugin-i18n | ||
kbn-eslint-plugin-imports | ||
kbn-eslint-plugin-telemetry | ||
kbn-expect | ||
kbn-failed-test-reporter-cli | ||
kbn-find-used-node-modules | ||
kbn-ftr-common-functional-services | ||
kbn-ftr-common-functional-ui-services | ||
kbn-ftr-screenshot-filename | ||
kbn-gen-ai-functional-testing | ||
kbn-generate | ||
kbn-generate-console-definitions | ||
kbn-get-repo-files | ||
kbn-import-locator | ||
kbn-import-resolver | ||
kbn-io-ts-utils | ||
kbn-jest-serializers | ||
kbn-journeys | ||
kbn-json-ast | ||
kbn-kibana-manifest-schema | ||
kbn-lint-packages-cli | ||
kbn-lint-ts-projects-cli | ||
kbn-managed-vscode-config | ||
kbn-managed-vscode-config-cli | ||
kbn-management | ||
kbn-manifest | ||
kbn-mock-idp-plugin | ||
kbn-mock-idp-utils | ||
kbn-openapi-bundler | ||
kbn-openapi-generator | ||
kbn-optimizer | ||
kbn-optimizer-webpack-helpers | ||
kbn-peggy | ||
kbn-peggy-loader | ||
kbn-performance-testing-dataset-extractor | ||
kbn-picomatcher | ||
kbn-plugin-check | ||
kbn-plugin-generator | ||
kbn-plugin-helpers | ||
kbn-relocate | ||
kbn-repo-file-maps | ||
kbn-repo-linter | ||
kbn-repo-path | ||
kbn-repo-source-classifier | ||
kbn-repo-source-classifier-cli | ||
kbn-scout | ||
kbn-scout-info | ||
kbn-scout-reporting | ||
kbn-set-map | ||
kbn-some-dev-log | ||
kbn-sort-package-json | ||
kbn-spec-to-console | ||
kbn-stdio-dev-helpers | ||
kbn-storybook | ||
kbn-styled-components-mapping-cli | ||
kbn-telemetry-tools | ||
kbn-test | ||
kbn-test-eui-helpers | ||
kbn-test-jest-helpers | ||
kbn-test-subj-selector | ||
kbn-tooling-log | ||
kbn-ts-projects | ||
kbn-ts-type-check-cli | ||
kbn-validate-next-docs-cli | ||
kbn-web-worker-stub | ||
kbn-whereis-pkg-cli | ||
kbn-yarn-lock-validator | ||
serverless/storybook/config | ||
README.md |
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
inpackage.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.