## Summary
* Auto-detect "upstream" and "origin" remotes (instead of assuming their
names).
* Allow relocating modules that are already in a "sustainable" folder.
* Filter out modules that are in the correct locations.
* Update the list of _modules to relocate_ to show only those modules
that are actually moved.
---------
Co-authored-by: Alejandro Fernández Haro <afharo@gmail.com>
In addition to changes introduced by #201142
Reasoning:
This pull request includes changes to the
`packages/kbn-test/src/jest/setup/react_testing_library.js` file to
improve internal error logging suppression from react-testing-library.
In particular,
[this](1e01273374/src/core/console.ts (L1-L4))
suppression logic has been migrated to avoid breaking devUX
expectations.
Tested against https://github.com/elastic/kibana/pull/201142 code
changes
## Summary
* Added link to rebase guideline in PR description.
* Do not count `elasticmachine` commits as manual.
* Replace references in CODEOWNERS file manual section.
* Update README prerequisites.
## Summary
This PR aims at relocating some of the Kibana modules (plugins and
packages) into a new folder structure, according to the _Sustainable
Kibana Architecture_ initiative.
> [!IMPORTANT]
> * We kindly ask you to:
> * Manually fix the errors in the error section below (if there are
any).
> * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the
source code (Babel and Eslint config files), and update them
appropriately.
> * Manually review
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that
any CI pipeline customizations continue to be correctly applied after
the changed path names
> * Review all of the updated files, specially the `.ts` and `.js` files
listed in the sections below, as some of them contain relative paths
that have been updated.
> * Think of potential impact of the move, including tooling and
configuration files that can be pointing to the relocated modules. E.g.:
> * customised eslint rules
> * docs pointing to source code
> [!NOTE]
> * This PR has been auto-generated.
> * Any manual contributions will be lost if the 'relocate' script is
re-run.
> * Try to obtain the missing reviews / approvals before applying manual
fixes, and/or keep your changes in a .patch / git stash.
> * Please use
[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)
Slack channel for feedback.
#### 1 plugin(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/ecs-data-quality-dashboard-plugin` |
`x-pack/solutions/security/plugins/ecs_data_quality_dashboard` |
#### 8 packages(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/cell-actions` | `src/platform/packages/shared/kbn-cell-actions`
|
| `@kbn/ecs-data-quality-dashboard` |
`x-pack/solutions/security/packages/ecs_data_quality_dashboard` |
| `@kbn/security-solution-features` |
`x-pack/solutions/security/packages/features` |
| `@kbn/security-solution-navigation` |
`x-pack/solutions/security/packages/navigation` |
| `@kbn/security-solution-side-nav` |
`x-pack/solutions/security/packages/side_nav` |
| `@kbn/security-solution-storybook-config` |
`x-pack/solutions/security/packages/storybook/config` |
| `@kbn/security-solution-upselling` |
`x-pack/solutions/security/packages/upselling` |
| `@kbn/securitysolution-ecs` |
`src/platform/packages/shared/kbn-securitysolution-ecs` |
<details >
<summary>Updated references</summary>
```
./.eslintrc.js
./.i18nrc.json
./docs/developer/plugin-list.asciidoc
./package.json
./packages/kbn-repo-packages/package-map.json
./packages/kbn-ts-projects/config-paths.json
./src/dev/storybook/aliases.ts
./src/platform/packages/shared/kbn-cell-actions/jest.config.js
./src/platform/packages/shared/kbn-securitysolution-ecs/jest.config.js
./tsconfig.base.json
./x-pack/.i18nrc.json
./x-pack/solutions/security/plugins/ecs_data_quality_dashboard/jest.config.js
./yarn.lock
```
</details><details >
<summary>Updated relative paths</summary>
```
src/platform/packages/shared/kbn-cell-actions/jest.config.js:12
src/platform/packages/shared/kbn-cell-actions/tsconfig.json:2
src/platform/packages/shared/kbn-securitysolution-ecs/jest.config.js:12
src/platform/packages/shared/kbn-securitysolution-ecs/tsconfig.json:2
x-pack/solutions/security/plugins/ecs_data_quality_dashboard/jest.config.js:15
x-pack/solutions/security/plugins/ecs_data_quality_dashboard/tsconfig.json:12
x-pack/solutions/security/plugins/ecs_data_quality_dashboard/tsconfig.json:2
```
</details>
---------
Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
This reverts commit b9bac1628b.
## Summary
Reverting to investigate `Failed to poll for work: Invalid interval
"PT1M". Intervals must be of the form {number}m. Example: 5m.` logs
which may be caused by the updated task schema
## Summary
Removes `pidusage` in favour of just getting cpu usage stats from
`node:process` for logging purposes. Other than that, not sure the point
of logging this, but keeping it in case it serves some purpose.
Closes#203983
## How to test
Not sure, make sure CI doesn't break or something from its removal,
given it is only used for logging.
## Summary
Adding initial documentation for the new Kibana Test Framework.
To reviewers: please read it carefully and provide your feedback/changes
so that we have a solid documentation in place.
## Summary
This PR aims at relocating some of the Kibana modules (plugins and
packages) into a new folder structure, according to the _Sustainable
Kibana Architecture_ initiative.
> [!IMPORTANT]
> * We kindly ask you to:
> * Manually fix the errors in the error section below (if there are
any).
> * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the
source code (Babel and Eslint config files), and update them
appropriately.
> * Manually review
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that
any CI pipeline customizations continue to be correctly applied after
the changed path names
> * Review all of the updated files, specially the `.ts` and `.js` files
listed in the sections below, as some of them contain relative paths
that have been updated.
> * Think of potential impact of the move, including tooling and
configuration files that can be pointing to the relocated modules. E.g.:
> * customised eslint rules
> * docs pointing to source code
> [!NOTE]
> * This PR has been auto-generated.
> * Any manual contributions will be lost if the 'relocate' script is
re-run.
> * Try to obtain the missing reviews / approvals before applying manual
fixes, and/or keep your changes in a .patch / git stash.
> * Please use
[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)
Slack channel for feedback.
#### 1 plugin(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/elastic-assistant-plugin` |
`x-pack/solutions/security/plugins/elastic_assistant` |
#### 3 packages(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/elastic-assistant` |
`x-pack/platform/packages/shared/kbn-elastic-assistant` |
| `@kbn/elastic-assistant-common` |
`x-pack/platform/packages/shared/kbn-elastic-assistant-common` |
| `@kbn/langchain` | `x-pack/platform/packages/shared/kbn-langchain` |
<details >
<summary>Updated references</summary>
```
./.buildkite/scripts/steps/code_generation/elastic_assistant_codegen.sh
./.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh
./.eslintrc.js
./.github/codeql/codeql-config.yml
./docs/developer/plugin-list.asciidoc
./oas_docs/scripts/merge_ess_oas.js
./oas_docs/scripts/merge_serverless_oas.js
./package.json
./packages/kbn-repo-packages/package-map.json
./packages/kbn-ts-projects/config-paths.json
./tsconfig.base.json
./tsconfig.base.type_check.json
./tsconfig.refs.json
./x-pack/.i18nrc.json
./x-pack/packages/kbn-elastic-assistant-common/README.md
./x-pack/platform/packages/shared/kbn-elastic-assistant-common/README.md
./x-pack/platform/packages/shared/kbn-elastic-assistant-common/env/README.md
./x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/capabilities/README.md
./x-pack/platform/packages/shared/kbn-elastic-assistant-common/jest.config.js
./x-pack/platform/packages/shared/kbn-elastic-assistant/README.md
./x-pack/platform/packages/shared/kbn-elastic-assistant/jest.config.js
./x-pack/platform/packages/shared/kbn-langchain/jest.config.js
./x-pack/plugins/elastic_assistant/README.md
./x-pack/plugins/security_solution/docs/openapi/README.md
./x-pack/solutions/security/plugins/elastic_assistant/README.md
./x-pack/solutions/security/plugins/elastic_assistant/jest.config.js
./x-pack/solutions/security/plugins/elastic_assistant/scripts/create_conversations_script.ts
./x-pack/solutions/security/plugins/elastic_assistant/server/__mocks__/docs_from_directory_loader.ts
./x-pack/solutions/security/plugins/elastic_assistant/server/knowledge_base/security_labs/embedding_security_in_llm_workflows.md
./x-pack/solutions/security/plugins/elastic_assistant/server/lib/attack_discovery/graphs/default_attack_discovery_graph/index.ts
./yarn.lock
```
</details><details >
<summary>Updated relative paths</summary>
```
x-pack/platform/packages/shared/kbn-elastic-assistant-common/jest.config.js:21
x-pack/platform/packages/shared/kbn-elastic-assistant-common/scripts/openapi/bundle.js:8
x-pack/platform/packages/shared/kbn-elastic-assistant-common/scripts/openapi/generate.js:8
x-pack/platform/packages/shared/kbn-elastic-assistant-common/tsconfig.json:2
x-pack/platform/packages/shared/kbn-elastic-assistant/jest.config.js:21
x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json:15
x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json:2
x-pack/platform/packages/shared/kbn-langchain/jest.config.js:20
x-pack/platform/packages/shared/kbn-langchain/tsconfig.json:2
x-pack/solutions/security/plugins/elastic_assistant/jest.config.js:14
x-pack/solutions/security/plugins/elastic_assistant/scripts/create_conversations.js:8
x-pack/solutions/security/plugins/elastic_assistant/scripts/draw_graph.js:8
x-pack/solutions/security/plugins/elastic_assistant/scripts/model_evaluator.js:8
x-pack/solutions/security/plugins/elastic_assistant/tsconfig.json:13
x-pack/solutions/security/plugins/elastic_assistant/tsconfig.json:2
```
</details>
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
closes https://github.com/elastic/observability-dev/issues/3377
## Metrics
#### `meta.query_range_secs` - The duration of the selected time range
in seconds.
#### `meta.query_offset_secs` - The offset from "now" to the
'rangeTo'/end' time picker value in seconds.
____
Extend the `onPageReady` function to support date ranges in the meta
field. The function should compute the query range in seconds based on
the provided time range and report it to telemetry as
meta.query_range_secs.
If the `rangeTo` is different from 'now', calculate the offset.
- A negative offset indicates that the rangeTo is in the past,
- a positive offset means it is in the future,
- and zero indicates that the rangeTo is exactly 'now'."
### How to instrument
To report the selected time range, pass the `rangeFrom` and `rangeTo` .
> Failing to pass the correct type will result in TS error.
Then, use this data when invoking onPageReady:
```
onPageReady({
meta: { rangeFrom, rangeTo },
});
```
### Analysis
Meta is flatten field. In order to aggregate the data it's necessary to
create a run time field. You can add a field in the
1. select data view (`ebt-kibana-*-performance-metrics`)
2. Add a new field
3. Type double
4. Set value
`query_range_secs`
```
def meta = doc[“meta”].size();
if (meta > 0) {
def range = doc[“meta.query_range_secs”].size();
if (range > 0) {
// Emit the value of ‘meta.target’
emit(Double.parseDouble(doc[“meta.query_range_secs”].value));
}
}
```
`query_offset_secs`
```
def meta = doc[“meta”].size();
if (meta > 0) {
def offset = doc[“meta.query_offset_secs”].size();
if (offset > 0) {
emit(Double.parseDouble(doc[“meta.query_offset_secs”].value));
}
}
```
### Examples
<img width="1478" alt="Screenshot 2024-12-09 at 19 51 32"
src="https://github.com/user-attachments/assets/72f796e1-4f20-487f-b62a-b6a4aead9a4a">
<img width="1478" alt="Screenshot 2024-12-09 at 19 56 08"
src="https://github.com/user-attachments/assets/c278dc3b-e6f3-47ed-9c90-954d71b59161">
<img width="1478" alt="Screenshot 2024-12-09 at 19 53 45 1"
src="https://github.com/user-attachments/assets/ef42ecef-48cd-4396-9f5d-c971098d5219">
### Notes
- Instrumented only 2 solutions as an example (dataset and apm services)
### TODO
- [x] Update documentation -
https://github.com/elastic/kibana/pull/204179
- [ ] Update dashboards (create a runtime field)
- [x] Track offset ( we need to know if the user selected now or now)
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR aims at relocating some of the Kibana modules (plugins and
packages) into a new folder structure, according to the _Sustainable
Kibana Architecture_ initiative.
> [!IMPORTANT]
> * We kindly ask you to:
> * Manually fix the errors in the error section below (if there are
any).
> * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the
source code (Babel and Eslint config files), and update them
appropriately.
> * Manually review
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that
any CI pipeline customizations continue to be correctly applied after
the changed path names
> * Review all of the updated files, specially the `.ts` and `.js` files
listed in the sections below, as some of them contain relative paths
that have been updated.
> * Think of potential impact of the move, including tooling and
configuration files that can be pointing to the relocated modules. E.g.:
> * customised eslint rules
> * docs pointing to source code
> [!NOTE]
> This PR has been auto-generated.
> Do not attempt to push any changes unless you know what you are doing.
> Please use
[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)
Slack channel for feedback.
#### 8 package(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/io-ts-utils` | `src/platform/packages/shared/kbn-io-ts-utils` |
| `@kbn/server-route-repository` |
`src/platform/packages/shared/kbn-server-route-repository` |
| `@kbn/server-route-repository-client` |
`src/platform/packages/shared/kbn-server-route-repository-client` |
| `@kbn/server-route-repository-utils` |
`src/platform/packages/shared/kbn-server-route-repository-utils` |
| `@kbn/sse-utils` | `src/platform/packages/shared/kbn-sse-utils` |
| `@kbn/sse-utils-client` |
`src/platform/packages/shared/kbn-sse-utils-client` |
| `@kbn/sse-utils-server` |
`src/platform/packages/private/kbn-sse-utils-server` |
| `@kbn/typed-react-router-config` |
`src/platform/packages/shared/kbn-typed-react-router-config` |
<details>
<summary>Updated references</summary>
```
./.i18nrc.json
./package.json
./packages/kbn-repo-packages/package-map.json
./packages/kbn-ts-projects/config-paths.json
./src/platform/packages/private/kbn-sse-utils-server/jest.config.js
./src/platform/packages/shared/kbn-io-ts-utils/jest.config.js
./src/platform/packages/shared/kbn-server-route-repository-client/jest.config.js
./src/platform/packages/shared/kbn-server-route-repository-utils/jest.config.js
./src/platform/packages/shared/kbn-server-route-repository/jest.config.js
./src/platform/packages/shared/kbn-sse-utils-client/jest.config.js
./src/platform/packages/shared/kbn-sse-utils/jest.config.js
./src/platform/packages/shared/kbn-typed-react-router-config/jest.config.js
./tsconfig.base.json
./yarn.lock
```
</details>
<details>
<summary>Updated relative paths</summary>
```
src/platform/packages/private/kbn-sse-utils-server/jest.config.js:12
src/platform/packages/private/kbn-sse-utils-server/tsconfig.json:2
src/platform/packages/shared/kbn-io-ts-utils/jest.config.js:12
src/platform/packages/shared/kbn-io-ts-utils/tsconfig.json:2
src/platform/packages/shared/kbn-server-route-repository-client/jest.config.js:12
src/platform/packages/shared/kbn-server-route-repository-client/tsconfig.json:2
src/platform/packages/shared/kbn-server-route-repository-utils/jest.config.js:12
src/platform/packages/shared/kbn-server-route-repository-utils/tsconfig.json:2
src/platform/packages/shared/kbn-server-route-repository/jest.config.js:12
src/platform/packages/shared/kbn-server-route-repository/tsconfig.json:2
src/platform/packages/shared/kbn-sse-utils-client/jest.config.js:12
src/platform/packages/shared/kbn-sse-utils-client/tsconfig.json:2
src/platform/packages/shared/kbn-sse-utils/jest.config.js:12
src/platform/packages/shared/kbn-sse-utils/tsconfig.json:2
src/platform/packages/shared/kbn-typed-react-router-config/jest.config.js:12
src/platform/packages/shared/kbn-typed-react-router-config/tsconfig.json:2
```
</details>
<details>
<summary>Script errors</summary>
```
```
</details>
## 📓 Summary
Closes#202652Closes#202653Closes#202654Closes#202656Closes#202657Closes#202658Closes#202660
These changes close issues as part of a bigger effort to integrate the
EUI changes.
This takes into account renaming `success` colour token to the more
appropriate `accentSecondary` as specified by the guidelines, and
updating legacy naming for tokens to the new respective names.
Also, it removes usages of the static `euiThemeVars` tokens and check
for usages `vis` tokens.
@patpscal Let me know if something feels off, I checked how the colour
render in the 4 theme combination (amsterdam/borealis + light/dark) and
it looks good to me.
---------
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR aims at relocating some of the Kibana modules (plugins and
packages) into a new folder structure, according to the _Sustainable
Kibana Architecture_ initiative.
> [!IMPORTANT]
> * We kindly ask you to:
> * Manually fix the errors in the error section below (if there are
any).
> * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the
source code (Babel and Eslint config files), and update them
appropriately.
> * Manually review
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that
any CI pipeline customizations continue to be correctly applied after
the changed path names
> * Review all of the updated files, specially the `.ts` and `.js` files
listed in the sections below, as some of them contain relative paths
that have been updated.
> * Think of potential impact of the move, including tooling and
configuration files that can be pointing to the relocated modules. E.g.:
> * customised eslint rules
> * docs pointing to source code
> [!NOTE]
> * This PR has been auto-generated.
> * Any manual contributions will be lost if the 'relocate' script is
re-run.
> * Try to obtain the missing reviews / approvals before applying manual
fixes, and/or keep your changes in a .patch / git stash.
> * Please use
[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)
Slack channel for feedback.
#### 2 packages(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/data-stream-adapter` |
`x-pack/solutions/security/packages/kbn-data-stream-adapter` |
| `@kbn/index-adapter` |
`x-pack/solutions/security/packages/kbn-index-adapter` |
---------
Co-authored-by: PhilippeOberti <philippe.oberti@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR adds support for explicit indication whether endpoint is
restricted to operator only users.
### Context
1. If user has [all operator
privileges](https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/operator/DefaultOperatorOnlyRegistry.java#L35-#L53)
granted, but is not listed as operator in `operator_users.yml`, ES would
throw an unauthorized error.
2. If user is listed as operator in `operator_users.yml`, but doesn't
have necessary privileges granted, ES would throw an unauthorized error.
3. It’s not possible to determine if a user is operator via any ES API,
i.e. `_has_privileges`.
4. If operator privileges are disabled we skip the the check for it,
that's why we require to explicitly specify additional privileges to
ensure that the route is protected even when operator privileges are
disabled.
### Checklist
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
__Relates: https://github.com/elastic/kibana/issues/196271__
### How to test
1. Add your user to the operators list
1bd8144924/packages/kbn-es/src/serverless_resources/operator_users.yml (L4)
or use existing user from the list to log in.
2. Run ES and Kibana serverless
3. Change any endpoint or create a new one with the following security
config
```
security: {
authz: {
requiredPrivileges: [ReservedPrivilegesSet.operator],
},
},
```
4. Check with enabled and disabled operator privileges (set
`xpack.security.operator_privileges.enabled`)
## Release Note
Added support for explicit indication whether endpoint is restricted to
operator only users at the route definition level.
---------
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary
This PR aims at relocating some of the Kibana modules (plugins and
packages) into a new folder structure, according to the _Sustainable
Kibana Architecture_ initiative.
> [!IMPORTANT]
> * We kindly ask you to:
> * Manually fix the errors in the error section below (if there are
any).
> * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the
source code (Babel and Eslint config files), and update them
appropriately.
> * Manually review
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that
any CI pipeline customizations continue to be correctly applied after
the changed path names
> * Review all of the updated files, specially the `.ts` and `.js` files
listed in the sections below, as some of them contain relative paths
that have been updated.
> * Think of potential impact of the move, including tooling and
configuration files that can be pointing to the relocated modules. E.g.:
> * customised eslint rules
> * docs pointing to source code
> [!NOTE]
> * This PR has been auto-generated.
> * Any manual contributions will be lost if the 'relocate' script is
re-run.
> * Try to obtain the missing reviews / approvals before applying manual
fixes, and/or keep your changes in a .patch / git stash.
> * Please use
[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)
Slack channel for feedback.
#### 2 plugin(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/threat-intelligence-plugin` |
`x-pack/solutions/security/plugins/threat_intelligence` |
| `@kbn/timelines-plugin` |
`x-pack/solutions/security/plugins/timelines` |
#### 2 packages(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/expandable-flyout` |
`x-pack/solutions/security/packages/kbn-expandable-flyout` |
| `@kbn/securitysolution-data-table` |
`x-pack/solutions/security/packages/data_table` |
Co-authored-by: PhilippeOberti <philippe.oberti@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
**Reviewers: Please test the code paths affected by this PR. See the
"Risks" section below.**
Part of work for enabling "high contrast mode" in Kibana. See
https://github.com/elastic/kibana/issues/176219.
**Background:**
Kibana will soon have a user profile setting to allow users to enable
"high contrast mode." This setting will activate a flag with
`<EuiProvider>` that causes EUI components to render with higher
contrast visual elements. Consumer plugins and packages need to be
updated selected places where `<EuiProvider>` is wrapped, to pass the
`UserProfileService` service dependency from the CoreStart contract.
**NOTE:** **EUI currently does not yet support the high-contrast mode
flag**, but support for that is expected to come in around 2 weeks.
These first PRs are simply preparing the code by wiring up the
`UserProvideService`.
### Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [X] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
### Risks
Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.
- [ ] [medium/high] The implementor of this change did not manually test
the affected code paths and relied on type-checking and functional tests
to drive the changes. Code owners for this PR need to manually test the
affected code paths.
- [ ] [medium] The `UserProfileService` dependency comes from the
CoreStart contract. If acquiring the service causes synchronous code to
become asynchronous, check for race conditions or errors in rendering
React components. Code owners for this PR need to manually test the
affected code paths.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
**Reviewers: Please test the code paths affected by this PR. See the
"Risks" section below.**
Part of work for enabling "high contrast mode" in Kibana. See
https://github.com/elastic/kibana/issues/176219.
**Background:**
Kibana will soon have a user profile setting to allow users to enable
"high contrast mode." This setting will activate a flag with
`<EuiProvider>` that causes EUI components to render with higher
contrast visual elements. Consumer plugins and packages need to be
updated selected places where `<EuiProvider>` is wrapped, to pass the
`UserProfileService` service dependency from the CoreStart contract.
**NOTE:** **EUI currently does not yet support the high-contrast mode
flag**, but support for that is expected to come in around 2 weeks.
These first PRs are simply preparing the code by wiring up the
`UserProvideService`.
### Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [X] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
### Risks
Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.
- [ ] [medium/high] The implementor of this change did not manually test
the affected code paths and relied on type-checking and functional tests
to drive the changes. Code owners for this PR need to manually test the
affected code paths.
- [ ] [medium] The `UserProfileService` dependency comes from the
CoreStart contract. If acquiring the service causes synchronous code to
become asynchronous, check for race conditions or errors in rendering
React components. Code owners for this PR need to manually test the
affected code paths.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Part of https://github.com/elastic/kibana/issues/200620
1. Remove usage of deprecated color variables
2. Remove usage of `@kbn/ui-theme`
3. A few other changes as requested by @andreadelrio
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
The following improvements have been made:
- Added `--json` flag to CLI command to output result as JSON
- Terminology updated to more accurately reflect object contents
- Code owner teams are always returned as an array
- Search path validation (is under repo root, exists)
- Proper handling of inline comments
- Better logging for `scripts/check_ftr_code_owners.js`
Existing usage of the `@kbn/code-owners` package has been updated
accordingly, without modifying outcomes.
## 📓 Summary
Related to https://github.com/elastic/kibana/pull/202985
This change reverts a suggestion that was applied but that should only
be valid for v9.
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
## Summary
A whole dependency was being pulled in for doing something that could
easily be done just using Node.js own utils and be made into a simple
method. As such, `multistream` has been removed since there is no other
place in the codebase that is using it.
## How to test
* Load Kibana local dev environment using synthtrace data/scenarios. No
scenario should fail to load normally, and all tests using synthtrace
data should pass as expected.
Closes#203860
## 📓 Summary
Closes#202258
This change updates the colors scale for Discover's `log.level`
indicators to differentiate errors from other levels better.
**N.B. As this relies on some hard-coded values defined
[here](https://github.com/elastic/kibana/issues/186273#issuecomment-2505817075),
it is not a definitive version, but a middle step to enhance the scale
in v8.x versions.**
With the introduction of the Borealis theme in v9, a new scale
token-based will replace this.
<img width="934" alt="Screenshot 2024-12-04 at 17 40 32"
src="https://github.com/user-attachments/assets/b3da1300-b39a-4ad0-92c9-fde5dabe91ec">
---------
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
## Summary
Functional tests for data usage UI.
- `data_streams` route is intercepted, due to filtering out zero size
data streams which will happen because metering api needs time to
aggregate data
- `autoops_api` is using the mock server as there will be no data for it
to return
- tests will only run in local serverless and not MKI due to using the
autoops mock server that won't return data for created data streams
- adds `interceptRequest` functionality to FTR `browser` service
## Tests
- data stream filter dropdown renders with created data streams of
`data_streams` response and are checked
- data stream filter dropdown renders badge with correct number of
selected data streams
- charts render from `data_streams` route response
- chart legends render with correct items
- popover renders for legend items
- links in popovers correctly navigate and update navigation between
different data stream items
## Summary
This PR aims at relocating some of the Kibana modules (plugins and
packages) into a new folder structure, according to the _Sustainable
Kibana Architecture_ initiative.
> [!IMPORTANT]
> * We kindly ask you to:
> * Manually fix the errors in the error section below (if there are
any).
> * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the
source code (Babel and Eslint config files), and update them
appropriately.
> * Manually review
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that
any CI pipeline customizations continue to be correctly applied after
the changed path names
> * Review all of the updated files, specially the `.ts` and `.js` files
listed in the sections below, as some of them contain relative paths
that have been updated.
> * Think of potential impact of the move, including tooling and
configuration files that can be pointing to the relocated modules. E.g.:
> * customised eslint rules
> * docs pointing to source code
> [!NOTE]
> This PR has been auto-generated.
> Do not attempt to push any changes unless you know what you are doing.
> Please use
[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)
Slack channel for feedback.
#### 7 package(s) are going to be relocated:
| Id | Target folder |
| -- | ------------- |
| `@kbn/ecs-data-quality-dashboard` |
`x-pack/solutions/security/packages/ecs_data_quality_dashboard` |
| `@kbn/security-solution-distribution-bar` |
`x-pack/solutions/security/packages/distribution_bar` |
| `@kbn/security-solution-features` |
`x-pack/solutions/security/packages/features` |
| `@kbn/security-solution-navigation` |
`x-pack/solutions/security/packages/navigation` |
| `@kbn/security-solution-side-nav` |
`x-pack/solutions/security/packages/side_nav` |
| `@kbn/security-solution-upselling` |
`x-pack/solutions/security/packages/upselling` |
| `@kbn/securitysolution-data-table` |
`x-pack/solutions/security/packages/data_table` |
<details>
<summary>Updated references</summary>
```
./.eslintrc.js
./package.json
./packages/kbn-repo-packages/package-map.json
./packages/kbn-ts-projects/config-paths.json
./tsconfig.base.json
./tsconfig.base.type_check.json
./tsconfig.refs.json
./x-pack/solutions/security/packages/data_table/jest.config.js
./x-pack/solutions/security/packages/distribution_bar/jest.config.js
./x-pack/solutions/security/packages/ecs_data_quality_dashboard/jest.config.js
./x-pack/solutions/security/packages/features/jest.config.js
./x-pack/solutions/security/packages/navigation/jest.config.js
./x-pack/solutions/security/packages/side_nav/jest.config.js
./x-pack/solutions/security/packages/upselling/jest.config.js
./x-pack/solutions/security/plugins/security_solution_serverless/tsconfig.type_check.json
./yarn.lock
```
</details>
<details>
<summary>Updated relative paths</summary>
```
x-pack/solutions/security/packages/data_table/jest.config.js:11
x-pack/solutions/security/packages/data_table/tsconfig.json:2
x-pack/solutions/security/packages/distribution_bar/jest.config.js:11
x-pack/solutions/security/packages/distribution_bar/tsconfig.json:2
x-pack/solutions/security/packages/ecs_data_quality_dashboard/jest.config.js:21
x-pack/solutions/security/packages/ecs_data_quality_dashboard/tsconfig.json:2
x-pack/solutions/security/packages/features/jest.config.js:10
x-pack/solutions/security/packages/features/tsconfig.json:2
x-pack/solutions/security/packages/navigation/jest.config.js:10
x-pack/solutions/security/packages/navigation/tsconfig.json:2
x-pack/solutions/security/packages/side_nav/jest.config.js:10
x-pack/solutions/security/packages/side_nav/src/solution_side_nav.stories.tsx:11
x-pack/solutions/security/packages/side_nav/tsconfig.json:2
x-pack/solutions/security/packages/upselling/jest.config.js:10
x-pack/solutions/security/packages/upselling/tsconfig.json:2
```
</details>
<details>
<summary>Script errors</summary>
```
```
</details>
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Angela Chuang <yi-chun.chuang@elastic.co>
Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
## Summary
This PR contains just the schema changes required to support backfill
actions. This is meant for an intermediate release and then the full PR:
https://github.com/elastic/kibana/pull/200784 will follow after that.
---------
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## 📓 Summary
Closes#203525
This change removes the conversion to lowercase for the `log.level`
field value shown in the flyout detail.
This will solve a bug while adding filters on the table from the badge
in the detail since forcing the value to lowercase was creating a
mismatching filter.
For `log.level` values normalization, we'll consider doing follow-up
work, as this is now unrelated to the bug fix.
https://github.com/user-attachments/assets/4ee7cdd9-1111-4f40-8edc-ffc46acc9b29
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
## Summary
Adds the `node scripts/relocate` functionality, that helps moving
modules to their intended locations, according to the _Sustainable
Kibana Architecture_.
Please refer to the README.md for further details and usage.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Fixes#202266
This PR fixes the underline rerendering issue at the `useSearchApi` hook
level, so any embeddable component who uses this hook would benefit from
the fix.
Ideally the props passed to the Lens component should be memoized, but
this assumption would break many integrations as the previous embeddable
component did take care of filtering duplicates.
To test this:
* Go to `Observability > Alerts > Manage rules` and `Add Rule`, pick the
`Custom threshold` option and verify the infinite reload does not happen
Once fixed this, another problem bubbled up with the brushing use case:
when brushing a chart the chart was always one time range step behind.
The other bug was due to the `fetch$(api)` function propagating a stale
`data` search context who the Lens embeddable was relying on.
To solve this other problem the following changes have been applied:
* read the `searchSessionId` from the `api` directly (used for
`autoRefresh`)
* make sure to test the `Refresh` feature with both relative and
absolute time ranges
* read the `search context` from the `parentApi` directly if implements
the `unifiedSearch` API
* to test this, brush and check that the final time range matches the
correct time range
**Note**: the fundamental issue for the latter is `fetch$` not emitting
the up-to-date `data` when the parentApi search context updates. The
retrieved `data` is stale and one step behind, so it is not reliable. cc
@elastic/kibana-presentation
As @ThomThomson noticed in his test failure investigation another issue
was found in this PR due to the wrong handling of the searchSessionId
within the Observability page (for more details see [his
analysis](https://github.com/elastic/kibana/pull/203150#issuecomment-2524080129)).
@markov00 and @crespocarlos helped risolve this problem with some
additional changes on the Observability side of things: this will lead
to some extra searchSessionId to be created, which will be eventually
solved by Observability team [shortly moving away from the
`searchSessionId`
mechanism](https://github.com/elastic/kibana/issues/203412)
### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
---------
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
This PR migrates test suites that use `renderHook` from the library
`@testing-library/react-hooks` to adopt the equivalent and replacement
of `renderHook` from the export that is now available from
`@testing-library/react`. This work is required for the planned
migration to react18.
## Context
In this PR, usages of `waitForNextUpdate` that previously could have
been destructured from `renderHook` are now been replaced with `waitFor`
exported from `@testing-library/react`, furthermore `waitFor`
that would also have been destructured from the same renderHook result
is now been replaced with `waitFor` from the export of
`@testing-library/react`.
***Why is `waitFor` a sufficient enough replacement for
`waitForNextUpdate`, and better for testing values subject to async
computations?***
WaitFor will retry the provided callback if an error is returned, till
the configured timeout elapses. By default the retry interval is `50ms`
with a timeout value of `1000ms` that
effectively translates to at least 20 retries for assertions placed
within waitFor. See
https://testing-library.com/docs/dom-testing-library/api-async/#waitfor
for more information.
This however means that for person's writing tests, said person has to
be explicit about expectations that describe the internal state of the
hook being tested.
This implies checking for instance when a react query hook is being
rendered, there's an assertion that said hook isn't loading anymore.
In this PR you'd notice that this pattern has been adopted, with most
existing assertions following an invocation of `waitForNextUpdate` being
placed within a `waitFor`
invocation. In some cases the replacement is simply a `waitFor(() => new
Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for
point out exactly why this works),
where this suffices the assertions that follow aren't placed within a
waitFor so this PR doesn't get larger than it needs to be.
It's also worth pointing out this PR might also contain changes to test
and application code to improve said existing test.
### What to do next?
1. Review the changes in this PR.
2. If you think the changes are correct, approve the PR.
## Any questions?
If you have any questions or need help with this PR, please leave
comments in this PR.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
The geoip database is not available in CI, so a `tags` field is added to
all ingested APM app log documents. This covers up the difference in
field counts between serverless CI and MKI by always having a `tags`
field in the documents. It also unskips the test that failed in MKI
because of this.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Implements an LLM-based root cause analysis process. At a high level, it
works by investigating entities - which means pulling in alerts, SLOs,
and log patterns. From there, it can inspect related entities to get to
the root cause.
The backend implementation lives in
`x-pack/packages/observability_utils-*` (`service_rca`). It can be
imported into any server-side plugin and executed from there.
The UI changes are mostly contained to
`x-pack/plugins/observability_solution/observabillity_ai_assistant_app`.
This plugin now exports a `RootCauseAnalysisContainer` which takes a
stream of data that is returned by the root cause analysis process.
The current implementation lives in the Investigate app. There, it calls
its own endpoint that kicks off the RCA process, and feeds it into the
`RootCauseAnalysisContainer` exposed by the Observability AI Assistant
app plugin. I've left it in a route there so the investigation itself
can be updated as the process runs - this would allow the user to close
the browser and come back later, and see a full investigation.
> [!NOTE]
> Notes for reviewing teams
>
> @kbn/es-types:
> - support both types and typesWithBodyKey
> - simplify KeysOfSources type
>
> @kbn/server-route-repository:
> - abortable streamed responses
>
> @kbn/sse-utils*:
> - abortable streamed responses
> - serialize errors in specific format for more reliable re-hydration
of errors
> - keep connection open with SSE comments
>
> @kbn/inference-*:
> - export *Of variants of types, for easier manual inference
> - add automated retries for `output` API
> - add `name` to tool responses for type inference (get type of tool
response via tool name)
> - add `data` to tool responses for transporting internal data (not
sent to the LLM)
> - simplify `chunksIntoMessage`
> - allow consumers of nlToEsql task to add to `system` prompt
> - add toolCallId to validation error message
>
> @kbn/aiops*:
> - export `categorizationAnalyzer` for use in observability-ai*
>
> @kbn/observability-ai-assistant*
> - configurable limit (tokens or doc count) for knowledge base recall
>
> @kbn/slo*:
> - export client that returns summary indices
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Maryam Saeidi <maryam.saeidi@elastic.co>
Co-authored-by: Bena Kansara <bena.kansara@elastic.co>
## Summary
- partly addresses https://github.com/elastic/kibana/issues/195523
- adds snapshot telemetry that shows number of legacy siem signals and
number of spaces they are in
- while working on PR, discovered and fixed few issues in APIs
- get migration status API did not work correctly with new `.alerts-*`
indices, listing them as outdated
- finalize migration API did account for spaces, when adding alias to
migrated index
- remove migration API failed due to lack of permissions to removed
migration task from `.tasks` index
### How to test
#### How to create legacy siem index?
run script that used for FTR tests
```bash
node scripts/es_archiver --kibana-url=http://elastic:changeme@localhost:5601 --es-url=http://elastic:changeme@localhost:9200 load x-pack/test/functional/es_archives/signals/legacy_signals_index
```
These would create legacy siem indices. But be aware, it might break
Kibana .alerts indices creation. But sufficient for testing
#### How to test snapshot telemetry
Snapshot
For snapshot telemetry use
[API](https://docs.elastic.dev/telemetry/collection/snapshot-telemetry#telemetry-usage-payload-api)
call
OR
Check snapshots in Kibana adv settings -> Global Settings Tab -> Usage
collection section -> Click on cluster data example link -> Check
`legacy_siem_signals ` fields in flyout
<details>
<summary> Snapshot telemetry </summary>
<img width="2549" alt="Screenshot 2024-12-03 at 13 08 03"
src="https://github.com/user-attachments/assets/28ffe983-01c7-4435-a82a-9a968d32d5e0">
</details>
---------
Co-authored-by: Ryland Herrick <ryalnd@gmail.com>