[8.x] [APM] Remove observability:searchExcludedDataTiers from serverless (#196380) (#196637)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[APM] Remove observability:searchExcludedDataTiers from serverless
(#196380)](https://github.com/elastic/kibana/pull/196380)

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

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

<!--BACKPORT [{"author":{"name":"Carlos
Crespo","email":"crespocarlos@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-17T08:00:57Z","message":"[APM]
Remove observability:searchExcludedDataTiers from serverless
(#196380)\n\nfixes
[#196378](https://github.com/elastic/kibana/issues/196378)\r\n\r\n##
Summary\r\n\r\n\"Excluded data tiers from search\" removed from
serverless.\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/7d93dc20-936c-459f-bc21-3da6ea6f30fd\">\r\n\r\nStill
present in stateful\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/aed6efb2-8eb3-44a1-aa64-17433d1ce94c\">\r\n\r\n\r\n**Bonus:**\r\n\r\nRemoved
the `_tier` filter noise, when the config was not set\r\n\r\n| Before |
After |\r\n| -------| ----- |\r\n|<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/b66aa65c-db5a-4879-a7ea-df675ae6790a\">|<img\r\nwidth=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/a4ff722d-e311-4d0e-8b7d-660a9d456b71\">|\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"bad11abb0754fab17626eecc1c5fee183b880dd2","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-major","ci:project-deploy-observability","Team:obs-ux-infra_services"],"title":"[APM]
Remove observability:searchExcludedDataTiers from
serverless","number":196380,"url":"https://github.com/elastic/kibana/pull/196380","mergeCommit":{"message":"[APM]
Remove observability:searchExcludedDataTiers from serverless
(#196380)\n\nfixes
[#196378](https://github.com/elastic/kibana/issues/196378)\r\n\r\n##
Summary\r\n\r\n\"Excluded data tiers from search\" removed from
serverless.\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/7d93dc20-936c-459f-bc21-3da6ea6f30fd\">\r\n\r\nStill
present in stateful\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/aed6efb2-8eb3-44a1-aa64-17433d1ce94c\">\r\n\r\n\r\n**Bonus:**\r\n\r\nRemoved
the `_tier` filter noise, when the config was not set\r\n\r\n| Before |
After |\r\n| -------| ----- |\r\n|<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/b66aa65c-db5a-4879-a7ea-df675ae6790a\">|<img\r\nwidth=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/a4ff722d-e311-4d0e-8b7d-660a9d456b71\">|\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"bad11abb0754fab17626eecc1c5fee183b880dd2"}},"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/196380","number":196380,"mergeCommit":{"message":"[APM]
Remove observability:searchExcludedDataTiers from serverless
(#196380)\n\nfixes
[#196378](https://github.com/elastic/kibana/issues/196378)\r\n\r\n##
Summary\r\n\r\n\"Excluded data tiers from search\" removed from
serverless.\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/7d93dc20-936c-459f-bc21-3da6ea6f30fd\">\r\n\r\nStill
present in stateful\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/aed6efb2-8eb3-44a1-aa64-17433d1ce94c\">\r\n\r\n\r\n**Bonus:**\r\n\r\nRemoved
the `_tier` filter noise, when the config was not set\r\n\r\n| Before |
After |\r\n| -------| ----- |\r\n|<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/b66aa65c-db5a-4879-a7ea-df675ae6790a\">|<img\r\nwidth=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/a4ff722d-e311-4d0e-8b7d-660a9d456b71\">|\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"bad11abb0754fab17626eecc1c5fee183b880dd2"}}]}]
BACKPORT-->

Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-10-18 01:06:45 +11:00 committed by GitHub
parent d068ea7b88
commit b43ffed762
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View file

@ -37,5 +37,4 @@ export const OBSERVABILITY_PROJECT_SETTINGS = [
settings.OBSERVABILITY_AI_ASSISTANT_SIMULATED_FUNCTION_CALLING,
settings.OBSERVABILITY_AI_ASSISTANT_SEARCH_CONNECTOR_INDEX_PATTERN,
settings.OBSERVABILITY_LOGS_DATA_ACCESS_LOG_SOURCES_ID,
settings.OBSERVABILITY_SEARCH_EXCLUDED_DATA_TIERS,
];

View file

@ -103,7 +103,7 @@ export class APMEventClient {
/** @deprecated Use {@link excludedDataTiers} instead.
* See https://www.elastic.co/guide/en/kibana/current/advanced-options.html **/
private readonly includeFrozen: boolean;
private readonly excludedDataTiers?: DataTier[];
private readonly excludedDataTiers: DataTier[];
private readonly inspectableEsQueriesMap?: WeakMap<KibanaRequest, InspectResponse>;
constructor(config: APMEventClientConfig) {
@ -112,7 +112,7 @@ export class APMEventClient {
this.request = config.request;
this.indices = config.indices;
this.includeFrozen = config.options.includeFrozen;
this.excludedDataTiers = config.options.excludedDataTiers;
this.excludedDataTiers = config.options.excludedDataTiers ?? [];
this.inspectableEsQueriesMap = config.options.inspectableEsQueriesMap;
}
@ -167,7 +167,7 @@ export class APMEventClient {
indices: this.indices,
});
if (this.excludedDataTiers) {
if (this.excludedDataTiers.length > 0) {
filters.push(...excludeTiersQuery(this.excludedDataTiers));
}
@ -207,7 +207,8 @@ export class APMEventClient {
// Reusing indices configured for errors since both events and errors are stored as logs.
const index = processorEventsToIndex([ProcessorEvent.error], this.indices);
const filter = this.excludedDataTiers ? excludeTiersQuery(this.excludedDataTiers) : undefined;
const filter =
this.excludedDataTiers.length > 0 ? excludeTiersQuery(this.excludedDataTiers) : undefined;
const searchParams = {
...omit(params, 'body'),
@ -249,7 +250,7 @@ export class APMEventClient {
indices: this.indices,
});
if (this.excludedDataTiers) {
if (this.excludedDataTiers.length > 0) {
filters.push(...excludeTiersQuery(this.excludedDataTiers));
}

View file

@ -13,10 +13,10 @@ export function getDataTierFilterCombined({
excludedDataTiers,
}: {
filter?: QueryDslQueryContainer;
excludedDataTiers?: DataTier[];
excludedDataTiers: DataTier[];
}): QueryDslQueryContainer | undefined {
if (!filter) {
return excludedDataTiers ? excludeTiersQuery(excludedDataTiers)[0] : undefined;
return excludedDataTiers.length > 0 ? excludeTiersQuery(excludedDataTiers)[0] : undefined;
}
return !excludedDataTiers