Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into disable-log-stream-…
Browse files Browse the repository at this point in the history
…and-settings
  • Loading branch information
gbamparop committed Dec 13, 2024
2 parents 7e202e6 + a69a456 commit e7c2afb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { omit } from 'lodash';
import type { Aggregation, Datafeed } from '../types/anomaly_detection_jobs';

export function getAggregations<T>(obj: any): T | undefined {
Expand All @@ -18,3 +19,10 @@ export const getDatafeedAggregations = (
): Aggregation | undefined => {
return getAggregations<Aggregation>(datafeedConfig);
};

export function getIndicesOptions(datafeedConfig?: Datafeed) {
// remove ignore_throttled from indices_options to avoid deprecation warnings in the logs
return datafeedConfig?.indices_options
? omit(datafeedConfig.indices_options, 'ignore_throttled')
: {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { getSeverityType } from '@kbn/ml-anomaly-utils';
import { getIndicesOptions } from '../../../../../common/util/datafeed_utils';
import type { MlResultsService } from '../../../services/results_service';
import type { CombinedJobWithStats } from '../../../../../common/types/anomaly_detection_jobs';
import type { Anomaly } from '../../../jobs/new_job/common/results_loader/results_loader';
Expand All @@ -32,7 +33,7 @@ export function chartLoaderProvider(mlResultsService: MlResultsService) {
job.data_counts.latest_record_timestamp!,
intervalMs,
job.datafeed_config.runtime_mappings,
job.datafeed_config.indices_options
getIndicesOptions(job.datafeed_config)
);
if (resp.error !== undefined) {
throw resp.error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { parseInterval } from '@kbn/ml-parse-interval';

import { initCardinalityFieldsCache } from './fields_aggs_cache';
import { isValidAggregationField } from '../../../common/util/validation_utils';
import { getDatafeedAggregations } from '../../../common/util/datafeed_utils';
import { getDatafeedAggregations, getIndicesOptions } from '../../../common/util/datafeed_utils';
import type { Datafeed, IndicesOptions } from '../../../common/types/anomaly_detection_jobs';

/**
Expand Down Expand Up @@ -190,7 +190,7 @@ export function fieldsServiceProvider({ asCurrentUser }: IScopedClusterClient) {
{
index,
body,
...(datafeedConfig?.indices_options ?? {}),
...getIndicesOptions(datafeedConfig),
},
{ maxRetries: 0 }
);
Expand Down Expand Up @@ -418,7 +418,7 @@ export function fieldsServiceProvider({ asCurrentUser }: IScopedClusterClient) {
{
index,
body,
...(datafeedConfig?.indices_options ?? {}),
...getIndicesOptions(datafeedConfig),
},
{ maxRetries: 0 }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validateTimeRange, isValidTimeField } from './validate_time_range';
import type { validateJobSchema } from '../../routes/schemas/job_validation_schema';
import type { CombinedJob } from '../../../common/types/anomaly_detection_jobs';
import type { MlClient } from '../../lib/ml_client';
import { getDatafeedAggregations } from '../../../common/util/datafeed_utils';
import { getDatafeedAggregations, getIndicesOptions } from '../../../common/util/datafeed_utils';
import type { AuthorizationHeader } from '../../lib/request_authorization';

export type ValidateJobPayload = TypeOf<typeof validateJobSchema>;
Expand Down Expand Up @@ -74,7 +74,7 @@ export async function validateJob(
timeField,
job.datafeed_config.query,
job.datafeed_config.runtime_mappings,
job.datafeed_config.indices_options
getIndicesOptions(job.datafeed_config)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
ML_JOB_ID,
ML_PARTITION_FIELD_VALUE,
} from '@kbn/ml-anomaly-utils';
import { getIndicesOptions } from '../../../common/util/datafeed_utils';
import { buildAnomalyTableItems } from './build_anomaly_table_items';
import { ANOMALIES_TABLE_DEFAULT_QUERY_SIZE } from '../../../common/constants/search';
import { getPartitionFieldsValuesFactory } from './get_partition_fields_values';
Expand Down Expand Up @@ -727,7 +728,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
size: 0,
},
...(datafeedConfig?.indices_options ?? {}),
...getIndicesOptions(datafeedConfig),
};

if (client) {
Expand Down

0 comments on commit e7c2afb

Please sign in to comment.