diff --git a/x-pack/plugins/apm/public/components/app/correlations/use_correlations.ts b/x-pack/plugins/apm/public/components/app/correlations/use_correlations.ts index 7ec4a5cbf43f0d..129b7b3a6de4aa 100644 --- a/x-pack/plugins/apm/public/components/app/correlations/use_correlations.ts +++ b/x-pack/plugins/apm/public/components/app/correlations/use_correlations.ts @@ -31,7 +31,6 @@ interface CorrelationsOptions { } interface RawResponse { - log: string[]; percentileThresholdValue?: number; took: number; values: SearchServiceValue[]; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/get_query_with_params.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/get_query_with_params.ts index e0ddfc1b053b5f..636e71add6ea85 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/get_query_with_params.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/get_query_with_params.ts @@ -12,7 +12,7 @@ import * as t from 'io-ts'; import type { estypes } from '@elastic/elasticsearch'; import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames'; -import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; +import type { SearchServiceFetchParams } from '../../../../common/search_strategies/correlations/types'; import { rangeRt } from '../../../routes/default_api_types'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; @@ -43,7 +43,7 @@ export const getTermsQuery = ( }; interface QueryParams { - params: SearchServiceParams; + params: SearchServiceFetchParams; fieldName?: string; fieldValue?: string; } diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_correlation.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_correlation.ts index f63c36f90d728a..94a708f6786009 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_correlation.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_correlation.ts @@ -10,7 +10,7 @@ import type { estypes } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from 'src/core/server'; import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames'; -import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; +import type { SearchServiceFetchParams } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; @@ -40,7 +40,7 @@ export interface BucketCorrelation { } export const getTransactionDurationCorrelationRequest = ( - params: SearchServiceParams, + params: SearchServiceFetchParams, expectations: number[], ranges: estypes.AggregationsAggregationRange[], fractions: number[], @@ -95,7 +95,7 @@ export const getTransactionDurationCorrelationRequest = ( export const fetchTransactionDurationCorrelation = async ( esClient: ElasticsearchClient, - params: SearchServiceParams, + params: SearchServiceFetchParams, expectations: number[], ranges: estypes.AggregationsAggregationRange[], fractions: number[], diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_field_candidates.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_field_candidates.ts index 0fbdfef405e0d1..8aa54e243eec90 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_field_candidates.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_field_candidates.ts @@ -9,7 +9,7 @@ import type { estypes } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from 'src/core/server'; -import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; +import type { SearchServiceFetchParams } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; import { Field } from './query_field_value_pairs'; @@ -37,7 +37,7 @@ export const hasPrefixToInclude = (fieldName: string) => { }; export const getRandomDocsRequest = ( - params: SearchServiceParams + params: SearchServiceFetchParams ): estypes.SearchRequest => ({ index: params.index, body: { @@ -56,7 +56,7 @@ export const getRandomDocsRequest = ( export const fetchTransactionDurationFieldCandidates = async ( esClient: ElasticsearchClient, - params: SearchServiceParams + params: SearchServiceFetchParams ): Promise<{ fieldCandidates: Field[] }> => { const { index } = params; // Get all fields with keyword mapping diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_field_value_pairs.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_field_value_pairs.ts index 8fde9d3ab13783..23928565da0849 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_field_value_pairs.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_field_value_pairs.ts @@ -11,7 +11,7 @@ import type { estypes } from '@elastic/elasticsearch'; import type { AsyncSearchProviderProgress, - SearchServiceParams, + SearchServiceFetchParams, } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; @@ -26,7 +26,7 @@ type FieldValuePairs = FieldValuePair[]; export type Field = string; export const getTermsAggRequest = ( - params: SearchServiceParams, + params: SearchServiceFetchParams, fieldName: string ): estypes.SearchRequest => ({ index: params.index, @@ -46,7 +46,7 @@ export const getTermsAggRequest = ( export const fetchTransactionDurationFieldValuePairs = async ( esClient: ElasticsearchClient, - params: SearchServiceParams, + params: SearchServiceFetchParams, fieldCandidates: Field[], progress: AsyncSearchProviderProgress ): Promise => { diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_fractions.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_fractions.ts index 3d623a4df8c344..e9cec25673c6eb 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_fractions.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_fractions.ts @@ -7,12 +7,12 @@ import { ElasticsearchClient } from 'kibana/server'; import { estypes } from '@elastic/elasticsearch'; -import { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; +import { SearchServiceFetchParams } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames'; export const getTransactionDurationRangesRequest = ( - params: SearchServiceParams, + params: SearchServiceFetchParams, ranges: estypes.AggregationsAggregationRange[] ): estypes.SearchRequest => ({ index: params.index, @@ -35,7 +35,7 @@ export const getTransactionDurationRangesRequest = ( */ export const fetchTransactionDurationFractions = async ( esClient: ElasticsearchClient, - params: SearchServiceParams, + params: SearchServiceFetchParams, ranges: estypes.AggregationsAggregationRange[] ): Promise<{ fractions: number[]; totalDocCount: number }> => { const resp = await esClient.search( diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram.ts index 6f61ecbfdcf081..045caabeab2685 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram.ts @@ -13,13 +13,13 @@ import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldname import type { HistogramItem, ResponseHit, - SearchServiceParams, + SearchServiceFetchParams, } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; export const getTransactionDurationHistogramRequest = ( - params: SearchServiceParams, + params: SearchServiceFetchParams, interval: number, fieldName?: string, fieldValue?: string @@ -42,7 +42,7 @@ export const getTransactionDurationHistogramRequest = ( export const fetchTransactionDurationHistogram = async ( esClient: ElasticsearchClient, - params: SearchServiceParams, + params: SearchServiceFetchParams, interval: number, fieldName?: string, fieldValue?: string diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram_interval.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram_interval.ts index c4d1abf24b4d65..0f897f2e9236e7 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram_interval.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram_interval.ts @@ -10,14 +10,14 @@ import type { estypes } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from 'src/core/server'; import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames'; -import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; +import type { SearchServiceFetchParams } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; const HISTOGRAM_INTERVALS = 1000; export const getHistogramIntervalRequest = ( - params: SearchServiceParams + params: SearchServiceFetchParams ): estypes.SearchRequest => ({ index: params.index, body: { @@ -32,7 +32,7 @@ export const getHistogramIntervalRequest = ( export const fetchTransactionDurationHistogramInterval = async ( esClient: ElasticsearchClient, - params: SearchServiceParams + params: SearchServiceFetchParams ): Promise => { const resp = await esClient.search(getHistogramIntervalRequest(params)); diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram_range_steps.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram_range_steps.ts index 6ee5dd6bcdf83b..ba57de2cfde3a3 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram_range_steps.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_histogram_range_steps.ts @@ -19,7 +19,7 @@ import type { estypes } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from 'src/core/server'; import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames'; -import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; +import type { SearchServiceFetchParams } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; @@ -32,7 +32,7 @@ const getHistogramRangeSteps = (min: number, max: number, steps: number) => { }; export const getHistogramIntervalRequest = ( - params: SearchServiceParams + params: SearchServiceFetchParams ): estypes.SearchRequest => ({ index: params.index, body: { @@ -47,7 +47,7 @@ export const getHistogramIntervalRequest = ( export const fetchTransactionDurationHistogramRangeSteps = async ( esClient: ElasticsearchClient, - params: SearchServiceParams + params: SearchServiceFetchParams ): Promise => { const steps = 100; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_percentiles.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_percentiles.ts index c80f5d836c0ef1..cb302f19a000b0 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_percentiles.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_percentiles.ts @@ -10,7 +10,7 @@ import type { estypes } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from 'src/core/server'; import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames'; -import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; +import type { SearchServiceFetchParams } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; import { SIGNIFICANT_VALUE_DIGITS } from './constants'; @@ -28,7 +28,7 @@ interface ResponseHit { } export const getTransactionDurationPercentilesRequest = ( - params: SearchServiceParams, + params: SearchServiceFetchParams, percents?: number[], fieldName?: string, fieldValue?: string @@ -58,7 +58,7 @@ export const getTransactionDurationPercentilesRequest = ( export const fetchTransactionDurationPercentiles = async ( esClient: ElasticsearchClient, - params: SearchServiceParams, + params: SearchServiceFetchParams, percents?: number[], fieldName?: string, fieldValue?: string diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_ranges.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_ranges.ts index 9074e7e0809bf7..0e813a18fdf4a8 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_ranges.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/query_ranges.ts @@ -10,7 +10,7 @@ import type { estypes } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from 'src/core/server'; import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames'; -import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; +import type { SearchServiceFetchParams } from '../../../../common/search_strategies/correlations/types'; import { getQueryWithParams } from './get_query_with_params'; @@ -27,7 +27,7 @@ interface ResponseHit { } export const getTransactionDurationRangesRequest = ( - params: SearchServiceParams, + params: SearchServiceFetchParams, rangesSteps: number[], fieldName?: string, fieldValue?: string @@ -65,7 +65,7 @@ export const getTransactionDurationRangesRequest = ( export const fetchTransactionDurationRanges = async ( esClient: ElasticsearchClient, - params: SearchServiceParams, + params: SearchServiceFetchParams, rangesSteps: number[], fieldName?: string, fieldValue?: string diff --git a/x-pack/test/apm_api_integration/tests/correlations/latency_ml.ts b/x-pack/test/apm_api_integration/tests/correlations/latency_ml.ts index cc8f48fb589445..5435578db0db5d 100644 --- a/x-pack/test/apm_api_integration/tests/correlations/latency_ml.ts +++ b/x-pack/test/apm_api_integration/tests/correlations/latency_ml.ts @@ -26,7 +26,6 @@ export default function ApiTest({ getService }: FtrProviderContext) { const getRequestBody = () => { const partialSearchRequest: PartialSearchRequest = { params: { - index: 'apm-*', environment: 'ENVIRONMENT_ALL', start: '2020', end: '2021',