diff --git a/x-pack/plugins/apm/public/components/app/correlations/index.tsx b/x-pack/plugins/apm/public/components/app/correlations/index.tsx index d96de9bfb6e87..a78774a0c4ea6 100644 --- a/x-pack/plugins/apm/public/components/app/correlations/index.tsx +++ b/x-pack/plugins/apm/public/components/app/correlations/index.tsx @@ -96,7 +96,7 @@ export function Correlations() { const properties: IStickyProperty[] = []; if (serviceName !== undefined && nextEnvironment !== undefined) { properties.push({ - label: i18n.translate('xpack.apm.transactionDetails.serviceLabel', { + label: i18n.translate('xpack.apm.correlations.serviceLabel', { defaultMessage: 'Service', }), fieldName: SERVICE_NAME, @@ -106,7 +106,7 @@ export function Correlations() { } if (urlParams.transactionName) { properties.push({ - label: i18n.translate('xpack.apm.transactionDetails.transactionLabel', { + label: i18n.translate('xpack.apm.correlations.transactionLabel', { defaultMessage: 'Transaction', }), fieldName: TRANSACTION_NAME, @@ -116,7 +116,7 @@ export function Correlations() { } if (urlParams.environment) { properties.push({ - label: i18n.translate('xpack.apm.transactionDetails.environmentLabel', { + label: i18n.translate('xpack.apm.correlations.environmentLabel', { defaultMessage: 'Environment', }), fieldName: SERVICE_ENVIRONMENT, 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 98a344c33f92e..e7cf8173b5bac 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 @@ -13,10 +13,7 @@ import { TRANSACTION_NAME, } from '../../../../common/elasticsearch_fieldnames'; import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types'; -import { - environmentQuery as getEnvironmentQuery, - rangeQuery as getRangeQuery, -} from '../../../utils/queries'; +import { environmentQuery as getEnvironmentQuery } from '../../../utils/queries'; import { ProcessorEvent } from '../../../../common/processor_event'; const getPercentileThresholdValueQuery = ( @@ -42,6 +39,22 @@ export const getTermsQuery = ( return fieldName && fieldValue ? [{ term: { [fieldName]: fieldValue } }] : []; }; +const getRangeQuery = ( + start?: string, + end?: string +): estypes.QueryDslQueryContainer[] => { + return [ + { + range: { + '@timestamp': { + ...(start !== undefined ? { gte: start } : {}), + ...(end !== undefined ? { lte: end } : {}), + }, + }, + }, + ]; +}; + interface QueryParams { params: SearchServiceParams; fieldName?: string; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/correlations/utils/math_utils.ts b/x-pack/plugins/apm/server/lib/search_strategies/correlations/utils/math_utils.ts index 9c829ec7c8061..01e856e511fc2 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/correlations/utils/math_utils.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/correlations/utils/math_utils.ts @@ -39,8 +39,6 @@ export const isHistogramRoughlyEqual = ( /** Round numeric to the nearest 5 * E.g. if roundBy = 5, results will be 11 -> 10, 14 -> 10, 16 -> 20 - * @param n - * @param roundBy */ export const roundToNearest = (n: number, roundBy = 5) => { return Math.ceil((n + 1) / roundBy) * roundBy; @@ -48,9 +46,6 @@ export const roundToNearest = (n: number, roundBy = 5) => { /** * Create a rough stringified version of the histogram - * @param histogram - * @param significantFraction - * @param numBinsToSample */ export const hashHistogram = ( histogram: HistogramItem[], diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index ce0c2e105adf6..ac1c1952080cc 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -237,13 +237,12 @@ export class APMPlugin }); // search strategies for async partial search results - core.getStartServices().then(() => { + if (plugins.data?.search?.registerSearchStrategy !== undefined) { plugins.data.search.registerSearchStrategy( 'apmCorrelationsSearchStrategy', apmCorrelationsSearchStrategyProvider() ); - }); - + } return { config$: mergedConfig$, getApmIndices: boundGetApmIndices, diff --git a/x-pack/plugins/ml/server/types.ts b/x-pack/plugins/ml/server/types.ts index d0a0be4c11e73..b04b8d8601772 100644 --- a/x-pack/plugins/ml/server/types.ts +++ b/x-pack/plugins/ml/server/types.ts @@ -20,8 +20,8 @@ import type { AlertingPlugin } from '../../alerting/server'; import type { ActionsPlugin } from '../../actions/server'; import type { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/server'; import type { - PluginSetup as PluginSetupData, - PluginStart as PluginStartData, + PluginSetup as DataPluginSetup, + PluginStart as DataPluginStart, } from '../../../../src/plugins/data/server'; export interface LicenseCheckResult { @@ -46,7 +46,7 @@ export interface SavedObjectsRouteDeps { export interface PluginsSetup { cloud: CloudSetup; - data: PluginSetupData; + data: DataPluginSetup; features: FeaturesPluginSetup; home: HomeServerPluginSetup; licensing: LicensingPluginSetup; @@ -58,7 +58,7 @@ export interface PluginsSetup { } export interface PluginsStart { - data: PluginStartData; + data: DataPluginStart; spaces?: SpacesPluginStart; } diff --git a/x-pack/plugins/observability/server/utils/queries.ts b/x-pack/plugins/observability/server/utils/queries.ts index cd1b4ab66f86e..2ee3291e7fb62 100644 --- a/x-pack/plugins/observability/server/utils/queries.ts +++ b/x-pack/plugins/observability/server/utils/queries.ts @@ -19,8 +19,8 @@ export function alertStatusQuery(status: AlertStatus) { } export function rangeQuery( - start?: number | string, - end?: number | string, + start?: number, + end?: number, field = '@timestamp' ): estypes.QueryDslQueryContainer[] { return [ @@ -29,9 +29,7 @@ export function rangeQuery( [field]: { gte: start, lte: end, - ...(typeof start === 'number' || typeof end === 'number' - ? { format: 'epoch_millis' } - : {}), + format: 'epoch_millis', }, }, },