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

[8.16] [APM] Remove observability:searchExcludedDataTiers from serverless (#196380) #196636

Merged
merged 1 commit into from
Oct 17, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down Expand Up @@ -167,7 +167,7 @@ export class APMEventClient {
indices: this.indices,
});

if (this.excludedDataTiers) {
if (this.excludedDataTiers.length > 0) {
filters.push(...excludeTiersQuery(this.excludedDataTiers));
}

Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -249,7 +250,7 @@ export class APMEventClient {
indices: this.indices,
});

if (this.excludedDataTiers) {
if (this.excludedDataTiers.length > 0) {
filters.push(...excludeTiersQuery(this.excludedDataTiers));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down